I have following code: <BR><BR>Dim strConnection As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:inetpubwwwrootGlenviewSysDatabaseGlenSys. mdb" <BR> Dim objConn As New System.Data.OleDb.OleDbConnection(strConnection) <BR> objConn.Open() <BR> Dim strSQL As String = "Insert Into CustomerService ([Name], Position, Company, Address, City, State, Zip, Country, Phone, Fax, Email, Information) VALUES ('" & _Name & "' , '" & _Position & "' , '" & _Company & "' , '" & _Address & "' , '" & _City & "' , '" & _State & "' , '" & _Zip & "' , '" & _Country & "' , '" & _Phone & "' , '" & _Fax & "' , '" & _Email & "' , '" & _Info & "' )" <BR> Dim objCommand As New System.Data.OleDb.OleDbCommand(strSQL, objConn) <BR> objCommand.ExecuteNonQuery() <BR> objConn.Close() <BR><BR><BR>when i run it i get this error: <BR><BR>Server Error in '/GlenviewSys' Application. <BR>-------------------------------------------------------------------------------- <BR><BR>Syntax error in INSERT INTO statement. <BR>Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. <BR><BR>Exception Details: System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement. <BR><BR>Source Error: <BR><BR><BR>Line 153: Dim strSQL As String = "Insert Into CustomerService ([Name], Position, Company, Address, City, State, Zip, Country, Phone, Fax, Email, Information) VALUES ('" & _Name & "' , '" & _Position & "' , '" & _Company & "' , '" & _Address & "' , '" & _City & "' , '" & _State & "' , '" & _Zip & "' , '" & _Country & "' , '" & _Phone & "' , '" & _Fax & "' , '" & _Email & "' , '" & _Info & "' )" <BR>Line 154: Dim objCommand As New System.Data.OleDb.OleDbCommand(strSQL, objConn) <BR>Line 155: objCommand.ExecuteNonQuery() <BR>Line 156: objConn.Close() <BR>Line 157
isplay the actual value of strSQL in the browser and then copy/paste that here for us to look at if the problem isn't then obvious.<BR><BR>(Do this directly after line 153 of the code you showed.)<BR><BR>One obvious question: *ARE* all those field in the CustomerService record NON-numeric? I would guess they are, but you should triple check.<BR><BR><BR>here is SQL <BR><BR>Insert Into CustomerService ([Name], Position, Company, Address, City, State, Zip, Country, Phone, Fax, Email, Information) VALUES ('Me' , 'hello' , 'bye' , '123 main' , 'City' , 'IL' , '60660' , 'USA' , '123-456-7899' , 'dfgdf' , '[email protected]' , '' )The only thing I can think of (and I admit I am just guessing) is that *perhaps* one of those other field names is a keyword in JET SQL.<BR><BR>You might try putting [...] around *every* field name instead of just around [Name].<BR><BR>I can think of other things it *might* be, but none of them match the error message you are seeing.<BR><BR>after i put brakets around all the name i got this:<BR><BR>Server Error in '/GlenviewSys' Application.<BR>--------------------------------------------------------------------------------<BR><BR>Operation must use an updateable query. <BR>Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. <BR><BR>Exception Details: System.Data.OleDb.OleDbException: Operation must use an updateable query.<BR><BR>Source Error: <BR><BR><BR>Line 153: Dim strSQL As String = "Insert Into CustomerService ([Name], [Position], [Company], [Address], [City], [State], [Zip], [Country], [Phone], [Fax], , [Information]) VALUES ('" & _Name & "' , '" & _Position & "' , '" & _Company & "' , '" & _Address & "' , '" & _City & "' , '" & _State & "' , '" & _Zip & "' , '" & _Country & "' , '" & _Phone & "' , '" & _Fax & "' , '" & _Email & "' , '" & _Info & "' )"<BR>Line 154: Dim objCommand As New System.Data.OleDb.OleDbCommand(strSQL, objConn)<BR>Line 155: objCommand.ExecuteNonQuery()<BR>Line 156: objConn.Close()<BR>Line 157:<BR> <BR><BR>Source File: c:inetpubwwwrootGlenviewSysClassesService.vb Line: 155 <BR><BR>So it *was* one of those field names that happened to be a SQL Keyword!<BR><BR>I wonder which one? I'd guess "Position", but I honestly don't know. But it doesn't matter; you've got it working.<BR><BR>Your new error is one that is encountered all the time. It almost always has to do with needing to set the permissions on the DB and/or the directory containing the DB. Try (temporarily!) granting *all* users read and write access to the directory with the .mdb file and to the .mdb file, itself.<BR><BR>And see also this FAQ:<BR>http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=107<BR><BR>
