That's one of many errors you will get
- see delimiters below
Carefully look at the code sample in my 1st post
The specific error is probably coming from the line
Set objCmd.ActiveConnection = dbConnection
Note that your snippet has
objCmd.CommandText = strlSQL
and the variable is strSQL not strlSQL
- there is no l (el) in the variable strSQL
And since I didn't know where you are getting your original dbConnection from my code sample presumed that someplace (like in your
include page) you declared that object correctly
- My code sample is making a new object objCmd as the active connection equal to that declaration
Typically can be done as:
'Create and open the database object
Set dbConnection = Server.CreateObject("ADODB.Connection")
dbConnection.Open "dsn=sba;uid=sbait;pwd=1981;"
' if that is a valid connection that works!
'Create the command object
Set objCmd = Server.CreateObject("ADODB.Command")
'Set the command object properties
Set objCmd.ActiveConnection = dbConnection
objCmd.CommandText = strSQL
objCmd.CommandType = adCmdText
'Execute the command
objCmd.Execute
As for delimiters
- my sample showed that you need to delimit each value passed based on its variable type
- using say a single quote before ' and another single quote after ' for text field values,
and a # before and after # for date fields, etc)
You don't have any delimiters in your code so unless they are all set as numbers in the DB field type (which I doubt based on your
data) you will get errors in the final update sql statement where they are required!
And your strInsert needs to build on itself from each prior strInsert, or it wipes out the prior values you are trying to build
For example you just have (no building and no delimiters and misplaced quotes) as
strInsert="lastName"= " & lastName & "
and should have
strInsert= strInsert & "lastName = '" & lastName & "'"
That is a single quote ( ' ) before the 1st closing quote in strInsert="lastName"= '"
And another single quote ( ' ) inside of the last set of quotes after & lastName &
For testing the strSQL to spot errors add the below response write code below just after the line
strSQL = strSQL & " WHERE bannerid = '" & bannerid &"'"
Response.Write "strSQL = " & crlf & strSQL &crlf & crlf 'Debug Only
Strongly Suggest you look at some tutorials or samples like at:
http://www.w3schools.com/asp/default.asp
and
http://www.asp101.com/samples/
PS
Don't post your site URL in the newsgroup since your code snippet appears to contain your actual DB user ID and password
|I cleaned up everything and now I am getting an error:
| Microsoft VBScript runtime error '800a01a8'
|
| Object required: 'objCmd'
|
| /sba_home/Students/Undergraduate/international/after-back-up-2-16-2005-do-not-touch_Copy.asp, line 165
|
| See bottome for line 165.
|
| Also, I could greatly appreciate if either of you would suggest some great
| books or references I could learn more ASP from, because right now I am a
| little lost to say the least. Thanks!
|
|
|
| <%
|
| Set dbConnection = Server.CreateObject("ADODB.Connection")
| dbConnection.Open "dsn=sba;uid=sbait;pwd=1981;"
|
| Dim strInsert
| adCmdText = 1
|
| bannerid = request.form("BannerID")
| strInsert="bannerid"= " & bannerid & "
| lastName = request.form("Last_name")
| strInsert="lastName"= " & lastName & "
| firstName = request.form("First_name")
| strInsert="firstName"= " & firstName & "
| 'nickName = request.form("nickname")
| sex = request.form("Sex")
| strInsert="sex"= " & sex & "
| birthday = request.form("Birthdate")
| strInsert="birthday"= " & birthday & "
| citizen = request.form("Citizen")
| strInsert="citizen"= " & citizen & "
| if citizen = "Yes" then citizen = 1 else citizen = 0
| major = request.form("Major")
| strInsert="major"= " & major & "
| creditHours = request.form("CreditHrs")
| strInsert="creditHours"= " & creditHours & "
| gpa = request.form("GPA")
| strInsert="gpa"= " & gpa &"
| tuitiontype = request.form("Tuition_Type")
| strInsert="tuitiontype" = " & tuitiontype & "
| Dorm = request.form("Campus_Mail")
| strInsert="Dorm"= " & Dorm & "
| if Dorm = "-1" then Dorm = 1 else Dorm = 0
| localAddress = request.form("Local_Address")
| strInsert="localAddress"= " & localAddress & "
| localApt = request.form("Local_Apt")
| strInsert="localApt"= " & localApt & "
| localCity = request.form("Local_City")
| strInsert="localCity"= " & localCity & "
| localState = request.form("Local_State")
| strInsert="localState"= " & localState & "
| localZipCode = request.form("Local_Zip")
| strInsert="localZipCode"= " & localZipCode & "
| localPhoneNumber = request.form("Local_Phone")
| strInsert="localPhoneNumber"= " & localPhoneNumber & "
| cellPhoneNumber = request.form("Cell_Phone")
| strInsert="cellPhoneNumber"= " & cellPhoneNumber & "
| Email = request.form("email")
| strInsert="Email"= " & Email & "
| PermanentAddress = request.form("Permanent_address")
| strInsert="PermanentAddress"= " & PermanentAddress & "
| PermanentCity = request.form("Permanant_City")
| strInsert="PermanentCity"= " & PermanentCity & "
| PermanentState = request.form("Permanent_State")
| strInsert="Permanent_State"= " & Permanent_State & "
| PermanentZipCode = request.form("Permanent_Zip")
| strInsert="PermanentZipCode"= " & PermanentZipCode & "
| PermanentPhoneNumber = request.form("Permanent_Phone")
| strInsert="PermanentPhoneNumber"= " & PermanentPhoneNumber & "
| overseasExp = request.form("Overseas_Experience")
| strInsert="overseasExp"= " & overseasExp & "
| ReasonsToTravel = request.form("Why_Attend")
| strInsert="ReasonToTravel"= " & ReasonToTravel & "
|
| Date_Submitted =date()
|
| defered = 0
|
|
| 'Student Program Choice
|
| choice1 = request.form("Choice1")
| strInsert = "choice1" = "& choice1 &"
| choice2 = request.form("Choice2")
| strInsert = "choice2" = "& choice2 &"
| choice3 = request.form("Choice3")
| strInsert = "choice3" = "& choice3 &"
| choice4 = request.form("Choice4")
| strInsert = "choice4" = "& choice4 &"
| choice5 = request.form("Choice5")
| strInsert = "choice5" = "& choice5 &"
| choice6 = request.form("Choice6")
| strInsert = "choice6" = "& choice6 &"
| choice7 = request.form("Choice7")
| strInsert = "choice7" = "& choice7 &"
|
|
| if (choice1 = "n/a") then
| choice1_status = ""
| else
| choice1_status = "Applied"
| end if
|
| if (choice2 = "n/a") then
| choice2_status = ""
| else
| choice2_status = "Applied"
| end if
|
| if (choice3 = "n/a") then
| choice3_status = ""
| else
| choice3_status = "Applied"
| end if
|
| if (choice4 = "n/a") then
| choice4_status = ""
| else
| choice4_status = "Applied"
| end if
| if (choice5 = "n/a") then
| choice5_status = ""
| else
| choice5_status = "Applied"
| end if
|
| if (choice6 = "n/a") then
| choice6_status = ""
| else
| choice6_status = "Applied"
| end if
|
| if (choice7 = "n/a") then
| choice7_status = ""
| else
| choice7_status = "Applied"
| end if
|
| 'Student Emergency Contact Information
|
| ecname = request.form("EC_Name")
| strInsert = "ecname" = "& ecname &"
| ecrelationship = request.form("EC_Relationship")
| strInsert = "ecrelationship" = " & ecrelationship & "
| ecaddress = request.form("EC_Address")
| strInsert = "ecaddress" = " & ecaddress & "
| eccity= request.form("EC_City")
| strInsert = "eccity" = " & eccity & "
| ecstate = request.form("EC_State")
| strInsert = "ecstate" = " & ecstate & "
| eczip = request.form("EC_Zip")
| strInsert = "eczip" = " & eczip & "
| echomephone = request.form("EC_HomePhone")
| strInsert = "echomephone" = " & echomephone & "
| echomecellphone = request.form("EC_HomeCellPhone")
| strInsert = "echomecellphone" = " & echomecellphone & "
|
|
|
|
| strSQL = "UPDATE student_data SET "&strInsert
| strSQL = strSQL&" WHERE bannerid = "& bannerid &""
|
|
| Set objCmd.ActiveConnection = dbConnection
| objCmd.CommandText = strlSQL
| objCmd.CommandType = adCmdText
| objCmd.Execute
|
|
|
|
|
| "Red_Star20" wrote:
|
| > I have an oracle database and a form... when trying to submit the data i get
| > the follwoing error....Microsoft OLE DB Provider for ODBC Drivers error
| > '80004005'
| >
| > [Oracle][ODBC][Ora]ORA-00921: unexpected end of SQL command
| >
| > /sba_home/Students/Undergraduate/international/George/International/apply/afterapply-back-up-2-16-2005-do-not-touch.asp, line 48
| >
| > Here is my code from line 1 to line 50:
| >
| > <html>
| >
| > <head>
| > <meta name="GENERATOR" content="Microsoft FrontPage 6.0">
| > <meta name="ProgId" content="FrontPage.Editor.Document">
| > <title>International</title>
| >
| > </head>
| >
| > <body>
| >
| > <!--#include file="../access/string.asp"-->
| > <%
| > Dim strInsert
| > adCmdText = 1
| >
| > bannerid = request.form("BannerID")
| > firstName = request.form("First_name")
| > lastName = request.form("Last_name")
| > nickName = request.form("nickname")
| > sex = request.form("Sex")
| > birthday = request.form("Birthdate")
| > citizen = request.form("Citizen")
| > if citizen = "Yes" then citizen = 1 else citizen = 0
| > major = request.form("Major")
| > creditHours = request.form("CreditHrs")
| > gpa = request.form("GPA")
| > Dorm = request.form("Campus_Mail")
| > if Dorm = "-1" then Dorm = 1 else Dorm = 0
| > localAddress = request.form("Local_Address")
| > localApt = request.form("Local_Apt")
| > localCity = request.form("Local_City")
| > localState = request.form("Local_State")
| > localZipCode = request.form("Local_Zip")
| > localPhoneNumber = request.form("Local_Phone")
| > cellPhoneNumber = request.form("Cell_Phone")
| > Email = request.form("email")
| > PermanentAddress = request.form("Permanent_address")
| > PermanentCity = request.form("Permanant_City")
| > PermanentState = request.form("Permanent_State")
| > PermanentZipCode = request.form("Permanent_Zip")
| > PermanentPhoneNumber = request.form("Permanent_Phone")
| > overseasExp = request.form("Overseas_Experience")
| > ReasonsToTravel = request.form("Why_Attend")
| >
| >
| > strSQL = "Update student_data SET bannerid = '"& BannerID &"' WHERE
| > BannerID = "& CurrentBannerID
| > THIS IS LINE 48 : dbConnection.execute(strSQL)
| > strSQL = "Update student_data SET firstName = '"& First_name &"' WHERE
| > BannerID = "& CurrentBannerID
| > dbConnection.execute(strSQL)
| >
| > I am frustrated beyond belief, have no clue what the problem can be...
| >
| >
| >
| >
| >
| >
| >
| >
| >