|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello - I thank anyone for help. - I have full connectivity to a database with full read write access. I have made sure several times of the names of my table and my fields and everything matches up. All the fields are of text type:
sSQL = "INSERT INTO expense " & _ "(User, Date, Code, Location, Amount, Method, Description) VALUES (" & sUser & ", " & sDate & ", " & sCode & ", " & sLocation & ", " & sAmount & ", " & sMethod & ", " & sDescription & ")" Microsoft OLE DB Provider for ODBC Drivers (0x80040E14) [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement. Also says - (I will validate with jscript when i get the code working) POST Data: User=aaron&Date=1-2-2003&select=6081+-+Gas&Location=amaco&Amount=35.00&select2=CompanyCredit&Description=test ALSO in another page I have, I can read records just fine from the table, but cannot write, delete, or update sSQL = "INSERT INTO used " & _ "(Make, Number, Year, PurchaseDate, Power, Miles, Hours) VALUES ('" & sMake & "', '" & sNumber & "', '" & sYear & "', '" & sPurchaseDate & "', '" & sPower & "', '" & sMiles & "', '" & sHours & "')" response.write sSQL Set sRS = sConn.Execute(sSQL) Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80040E14) [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement. /test/add.asp, line 21 POST Data: Make=M&Number=N&Year=Y&PurchaseDate=D&Power=P&Miles=M&Hours%3C=H ************************************************** ********************** sSQL = "DELETE FROM used WHERE Number = '" & sNumber & "'" response.write sSQL Set sRS = sConn.Execute(sSQL) Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80040E14) [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement. /test/add.asp, line 21 Browser Type: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Page: POST 64 bytes to /test/add.asp POST Data: Make=M&Number=N&Year=Y&PurchaseDate=D&Power=P&Miles=M&Hours%3C=H nancyhaehl: Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80004005) [Microsoft][ODBC Microsoft Access Driver] Could not delete from specified tables. /test/delete.asp, line 14 POST Data: number=100 ************************************************** ********************** sNumber = Request.Form("Number") sMake = Request.Form("Make") sYear = Request.Form("Year") sPurchaseDate = Request.Form("PurchaseDate") sPower = Request.Form("Power") sMiles = Request.Form("Miles") sHours = Request.Form("Hours") ' *** Define SQL so that it updates the desired record *** ' sSQL = "UPDATE used SET " & _ "Make = " & sMake & ", " & _ "Year = " & sYear & ", " & _ "PurchaseDate = " & sPurchaseDate & ", " & _ "Power = " & sPower & ", " & _ "Miles = " & sMiles & ", " & _ "Hours = " & sHours & ", " & _ "WHERE Number = " & sNumber & "" Set sRS = sConn.Execute(sSQL) Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80040E14) [Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement. /test/update.asp, line 25 POST Data: number=100&Make=Osh-Kosh&year=1998&purchasedate=2%2F3%2F1997&Power=Osh-Kosh&Miles=112344&Hours=12345 I would greatly appreciate any help. I can send files if need be. I have been staring at these files for a week and i am really getting frustrated. Thanks very much, Aaron Haehl ![]() |
|
#2
|
|||
|
|||
|
When you insert numbers, you don't need single quotes and when you insert strings you do.
So for example sSQL = "DELETE FROM used WHERE Number = '" & sNumber & "'" should be: sSQL = "DELETE FROM used WHERE Number = " & sNumber You didn't mention whether you were using access or SQL server. If you're using access, you should be careful about using "Number" as a field name, since it's a reserved word. You would be better renaming the field or you'll have to use [Number] in your statements. For a list of all reserved terms, see http://www.aspfaq.com/show.asp?id=2080 |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft SQL Server > Can read, cant update, insert, delete |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|