Forums
This topic is locked
Data Form
Posted 02 Mar 2004 05:42:38
1
has voted
02 Mar 2004 05:42:38 Huck Huckabee posted:
I am trying to connect a database to a website for the first time using Sean Nicholson's Dreamweaver MX2004 and Databases. I am at a point where I don't know where to go next. Any help would be appreciated.I am creating a form in Dreamweaver from an Access database using Record Insertion Form Wizard. When I test the form I get the following error:
System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement.
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr)
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()
Edited by - huck4 on 02 Mar 2004 06:18:41
Replies
Replied 06 Feb 2006 01:51:09
06 Feb 2006 01:51:09 Carlos carlosp replied:
I am having a similar problem, I hope that someone can help me, please.
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>
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>
Replied 06 Feb 2006 03:24:50
06 Feb 2006 03:24:50 Javier Castro replied:
It could be that you are using some Reserved words on your fields or record names.
For example, date is a reseved word and you cannot use it as is, you can use something like dteDate. See this link for a list of reserved words: support.microsoft.com/kb/q209187/
Also you can check the www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_14622 at the bottom of the page you'll see other links as well.
Cheers,
Javier
For example, date is a reseved word and you cannot use it as is, you can use something like dteDate. See this link for a list of reserved words: support.microsoft.com/kb/q209187/
Also you can check the www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_14622 at the bottom of the page you'll see other links as well.
Cheers,
Javier
Replied 06 Feb 2006 03:49:16
06 Feb 2006 03:49:16 Carlos carlosp replied:
Thanks Javier,
I finally solved it. The problem was with the permissions. I didn't know that Windows 2003 server uses the NETWORK SERVICE account to execute asp .Net code (unlike other servers that use the ASPNET account) or more common yet the IUSR_machinename account for traditional asp.
I hope that someone else finds this useful. Just grant read/write permissions to the database file and that's it.
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
It could be that you are using some Reserved words on your fields or record names.
For example, date is a reseved word and you cannot use it as is, you can use something like dteDate. See this link for a list of reserved words: support.microsoft.com/kb/q209187/
Also you can check the www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_14622 at the bottom of the page you'll see other links as well.
Cheers,
Javier
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
I finally solved it. The problem was with the permissions. I didn't know that Windows 2003 server uses the NETWORK SERVICE account to execute asp .Net code (unlike other servers that use the ASPNET account) or more common yet the IUSR_machinename account for traditional asp.
I hope that someone else finds this useful. Just grant read/write permissions to the database file and that's it.
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
It could be that you are using some Reserved words on your fields or record names.
For example, date is a reseved word and you cannot use it as is, you can use something like dteDate. See this link for a list of reserved words: support.microsoft.com/kb/q209187/
Also you can check the www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_14622 at the bottom of the page you'll see other links as well.
Cheers,
Javier
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Replied 02 Mar 2007 00:12:53
02 Mar 2007 00:12:53 Raj Vaswani replied:
PERFECT!!! Thanks! Network Service account who knew!!!