Get ready for BLACK FRIDAY shopping starting in

Forums

This topic is locked

unable to add records to database using aspx .net

Posted 06 Feb 2006 02:00:45
1
has voted
06 Feb 2006 02:00:45 Carlos carlosp posted:
I hope that someone can help me, please.
I am using .net v2 and this problem ocurrs when using Dreamweaver 8's feature "Record insertion form wizard"

Any help would be greatly appreciated
This is the error I get when submitting a very simple INSERT statement using an Access Database (which does have read/write permissions for IUSR_Guest

System.Data.OleDb.OleDbException: Operation must use an updateable query.
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
at DreamweaverCtrls.DataSet.DoInit()

Below you can find the Dreamweaver generated code:

“%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
“%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls" Assembly="DreamweaverCtrls,version=1.0.0.0,publicKeyToken=836f606ede05d46a,culture=neutral" %>
&#8220;MM<img src=../images/dmxzone/forum/icon_smile_blush.gif border=0 align=middle>nsert
runat="server"
CommandText='&#8220;%# "INSERT INTO Categorias (Categoria) VALUES (?)" %&gt;'
ConnectionString='&#8220;%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_conBateo" %&gt;'
DatabaseType='&#8220;%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETYPE_conBateo" %&gt;'
Expression='&#8220;%# Request.Form("MM_insert" = "form1" %&gt;'
CreateDataSet="false"
SuccessURL='&#8220;%# "default.aspx" %&gt;'
Debug="true"
&gt;
&#8220;Parameters&gt;
&#8220;Parameter Name="@Categoria" Value='&#8220;%# IIf((Request.Form("Categoria" &#8220;&gt; Nothing), Request.Form("Categoria", "" %&gt;' Type="WChar" /&gt;
&#8220;/Parameters&gt;
&#8220;/MM<img src=../images/dmxzone/forum/icon_smile_blush.gif border=0 align=middle>nsert&gt;
&#8220;MM<img src=../images/dmxzone/forum/icon_smile_tongue.gif border=0 align=middle>ageBind runat="server" PostBackBind="true" /&gt;
&#8220;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&#8220;html xmlns="www.w3.org/1999/xhtml"&gt;
&#8220;head&gt;
&#8220;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;
&#8220;title&gt;Untitled Document&#8220;/title&gt;
&#8220;/head&gt;
&#8220;body&gt;
&#8220;form method="post" name="form1" runat="server"&gt;
&#8220;table align="center"&gt;
&#8220;tr valign="baseline"&gt;
&#8220;td&gt;&#8220;asp:textbox id="Categoria" TextMode="SingleLine" Columns="32" runat="server" /&gt;
&#8220;/td&gt;
&#8220;td&gt;&#8220;input type="submit" value="Crear categor&iacute;a"&gt;&#8220;/td&gt;
&#8220;/tr&gt;
&#8220;/table&gt;
&#8220;input type="hidden" name="MM_insert" value="form1"&gt;
&#8220;/form&gt;
&#8220;p&gt;&nbsp;&#8220;/p&gt;
&#8220;/body&gt;
&#8220;/html&gt;


Replies

Replied 06 Feb 2006 02:37:20
06 Feb 2006 02:37:20 Carlos carlosp replied:
I found out what I was doing wrong... Check your permissions.
Windows 2003 Server uses a special account for ASP.NET called NETWORK SERVICE
(not the traditional IUSR_MachineName account)
Carefull though, there are other .NET servers (other than win 2003) that use the account ASPNET to execute... remeber to enable read/write permissions for it in the directory where you store your access database.

This article might prove very useful
imar.spaanjaars.com/QuickDocId.aspx?QUICKDOC=287

You're welcome <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

Reply to this topic