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