|
-
Jun 22nd, 2006, 09:00 PM
#1
Thread Starter
Lively Member
ASP Error - Syntax Error
strSQL = "insert into course values ('"+request.form("dNAME")+"','"+request.form("cNAME")+"',"+request.form("cNO")+");"
This is the error which i received while trying to do an insert statement into a database.
Could someone help me ?
Error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
Thank you.
-
Jun 22nd, 2006, 09:29 PM
#2
Lively Member
Re: ASP Error - Syntax Error
This is probably because you are trying to insert values into a column that does not allow NULL values.
You can change this setting in SQL enterprise manager.
Let me know if you still have problems.
-
Jun 22nd, 2006, 09:54 PM
#3
Thread Starter
Lively Member
Re: ASP Error - Syntax Error
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("db1.mdb")
Is there anything wrong with this line of codes?
Thank you, cause i did add in values into the required fields.
-
Jun 22nd, 2006, 10:39 PM
#4
Junior Member
Re: ASP Error - Syntax Error
Are you using javascript as your ASP language? If not, you are using a wrong syntax to concatenate string. Use "+" for javascript, use "&" for vbscript.
Try this:
strSQL = "insert into course values ('" & request.form("dNAME") & "','" & request.form("cNAME") & "'," & request.form("cNO") & ");"
-
Jun 22nd, 2006, 10:48 PM
#5
PowerPoster
Re: ASP Error - Syntax Error
Make sure they arent null also, especially the Number Field ..
VB Code:
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("./db1.mdb")
strSQL = "INSERT INTO course (dNAME, cNAME, cNO) VALUES ('" & request.form("dNAME") & "','" & request.form("cNAME") & "'," & request.form("cNO") & ");"
adoCon.Execute(strSQL)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|