|
-
Aug 10th, 2002, 11:25 AM
#1
Thread Starter
Lively Member
DB entry doesn't work
hi
can somebody tell me what wrong here? because it tells me that there is an error on line 39, and line 39 is the the last line posted here (adoCon.Execute (strSQL)
it also tells that there is a synthax error in the INSERT INTO part
Code:
Set adoCon = Server.CreateObject("ADODB.Connection")
Set rsAddNewRecord = Server.CreateObject("ADODB.Recordset")
strCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("../dbroot/Names.mdb")
adoCon.Open strCon
strSQL = "INSERT INTO NameDB (Name, Language, Quality, Rating)"
strSQL = strSQL & " VALUES "
strSQL = strSQL & "('" & Name
strSQL = strSQL & "', '" & Language
strSQL = strSQL & "', '" & Quality
strSQL = strSQL & "', " & Rating
strSQL = strSQL & "' );"
adoCon.Execute (strSQL)
Name, Language, Quality, Rating are defined someplace upper in the code, there extracted from a form and Rating is a number in the form and coverted using this
Code:
Rating = "<img src=images/rating" & Request.Form("rating") & ".gif>"
thx 4 help!
-=R0ckAw4Y=-
-
Aug 10th, 2002, 05:39 PM
#2
Re: DB entry doesn't work
Originally posted by -=R0ckAw4Y=-
hi
can somebody tell me what wrong here? because it tells me that there is an error on line 39, and line 39 is the the last line posted here (adoCon.Execute (strSQL)
it also tells that there is a synthax error in the INSERT INTO part
Code:
Set adoCon = Server.CreateObject("ADODB.Connection")
Set rsAddNewRecord = Server.CreateObject("ADODB.Recordset")
strCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("../dbroot/Names.mdb")
adoCon.Open strCon
strSQL = "INSERT INTO NameDB (Name, Language, Quality, Rating)"
strSQL = strSQL & " VALUES "
strSQL = strSQL & "('" & Name
strSQL = strSQL & "', '" & Language
strSQL = strSQL & "', '" & Quality
strSQL = strSQL & "', " & Rating
strSQL = strSQL & "' );"
adoCon.Execute (strSQL)
Name, Language, Quality, Rating are defined someplace upper in the code, there extracted from a form and Rating is a number in the form and coverted using this
Code:
Rating = "<img src=images/rating" & Request.Form("rating") & ".gif>"
thx 4 help!
-=R0ckAw4Y=-
Hi,
There is an extra single quote at the end [ "'")"] also wrap a brace around the field name [e.g. [Name] instaead of Name], that might cause problem as its a keyword.
Hope this helps.
Danial
[VBF RSS Feed]
There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.
If I have been helpful, Please Rate my Post. Thanks.
This post was powered by : 
-
Aug 10th, 2002, 06:23 PM
#3
Thread Starter
Lively Member
Code:
strSQL = "INSERT INTO NameDB (Name, Language, Quality, Rating)"
strSQL = strSQL & " VALUES "
strSQL = strSQL & "('" & [Name]
strSQL = strSQL & "', '" & [Language]
strSQL = strSQL & "', '" & [Quality]
strSQL = strSQL & "', " & [Rating]
strSQL = strSQL & ");"
adoCon.Execute (strSQL)
is this what you mean? because the error is still the same
-
Aug 10th, 2002, 06:27 PM
#4
Originally posted by -=R0ckAw4Y=-
Code:
strSQL = "INSERT INTO NameDB (Name, Language, Quality, Rating)"
strSQL = strSQL & " VALUES "
strSQL = strSQL & "('" & [Name]
strSQL = strSQL & "', '" & [Language]
strSQL = strSQL & "', '" & [Quality]
strSQL = strSQL & "', " & [Rating]
strSQL = strSQL & ");"
adoCon.Execute (strSQL)
is this what you mean? because the error is still the same
This is what i meant
VB Code:
strsql = "INSERT INTO NameDB ([Name], [Language], Quality, Rating)"
strsql = strsql & " VALUES "
strsql = strsql & "('" & Name
strsql = strsql & "', '" & Language
strsql = strsql & "', '" & Quality
strsql = strsql & "', " & Rating
strsql = strsql & ");"
adoCon.Execute (strSQL)
[VBF RSS Feed]
There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.
If I have been helpful, Please Rate my Post. Thanks.
This post was powered by : 
-
Aug 10th, 2002, 06:31 PM
#5
Thread Starter
Lively Member
THX A LOT! it worx
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
|