Conn = "provider = Microsoft. Jet. oledb.4.0; Data Source =" + server. mappath ("test. mdb ");
Strconn = new oledbconnection (conn );
Strconn. open ();
Strsql = "insert into content (content) vlaues ('" + txtcontent + "')";
Cmd = new oledbcommand (strsql, strconn );
Cmd. executenonquery ();
Cmd. Dispose ();
Strconn. Close ();
A server error occurs in the "/test" application.
--------------------------------------------------------------------------------
The syntax of the insert into statement is incorrect.
Note: An unhandled exception occurs during the execution of the current Web request. Check the stack trace information for details about the error and the source of the error in the code.
Exception details: system. Data. oledb. oledbexception: syntax error of the insert into statement.
Source error:
Row 65: strsql = "insert into content (content) vlaues ('" + txtcontent + "')";
Row 66: cmd = new oledbcommand (strsql, strconn );
Row 67: cmd. executenonquery ();
Row 68: cmd. Dispose ();
Row 69: strconn. Close ();
Source File: C:/inetpub/wwwroot/test/webform1.aspx. CS row: 67
Stack trace:
[Oledbexception (0x80040e14): the syntax of the insert into statement is incorrect.]
System. Data. oledb. oledbcommand. executecommandtexterrorhandling (int32 hr) + 41
System. Data. oledb. oledbcommand. executecommandtextforsingleresult (tagdbparams dbparams, object & executeresult) + 174
System. Data. oledb. oledbcommand. executecommandtext (Object & executeresult) + 92
System. Data. oledb. oledbcommand. executecommand (commandbehavior behavior, object & executeresult) + 65
System. Data. oledb. oledbcommand. executereaderinternal (commandbehavior behavior, string method) + 112
System. Data. oledb. oledbcommand. executenonquery ()
Test. webform1.button1 _ click (Object sender, eventargs E) in C:/inetpub/wwwroot/test/webform1.aspx. CS: 67
System. Web. UI. webcontrols. Button. onclick (eventargs E)
System. Web. UI. webcontrols. Button. system. Web. UI. ipostbackeventhandler. raisepostbackevent (string eventargument)
System. Web. UI. Page. raisepostbackevent (ipostbackeventhandler sourcecontrol, string eventargument)
System. Web. UI. Page. raisepostbackevent (namevaluecollection postdata)
System. Web. UI. Page. processrequestmain () + 1277
--------------------------------------------------------------------------------
Version: Microsoft. NET Framework Version: 1.1.4322.573; ASP. NET version: 1.1.4322.573