Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ok, Im getting an odd error, is it a server version issue?

Status
Not open for further replies.

limberwulf

IS-IT--Management
Feb 4, 2002
20
0
0
US

I know my sql statement is in a big long line, but the error Im getting is unusual.

this is the error.
Microsoft VBScript compilation error '800a0401'

Expected end of statement

/managers/computerproblem.asp, line 18

INSERT INTO troubleticket(Property_num,User_name,Issue_Month,Issue_Day,Issue_Year,Issue_type,Issue,Description) VALUES(" & "'" & Property_num & "','" & User_name & "','" & Issue_Month & "','" & Issue_Day & "','" & Issue_Year & "','" & Issue_type & "','" & Issue & "','" & Description & "'" & ")
------------^

and this is my code. any ideas?

<%

response.buffer = &quot;true&quot;

Property_num=request.querystring(&quot;property&quot;)
User_name=request.querystring(&quot;computer_user&quot;)
Issue_Month=request.querystring(&quot;month&quot;)
Issue_Day=request.querystring(&quot;Day&quot;)
Issue_Year=request.querystring(&quot;Year&quot;)
Issue_type=request.querystring(&quot;issue_type&quot;)
Issue=request.querystring(&quot;specific_Issue&quot;)
Description=request.querystring(&quot;description&quot;)

sDBName = &quot;Driver={Microsoft Access Driver (*.mdb)}; DBQ=f:\0ED\artcraftcos.com\files\databases\computer_trouble.mdb;&quot;
Set objDB = Server.CreateObject(&quot;ADODB.Connection&quot;)
objDB.open

INSERT INTO troubleticket(Property_num,User_name,Issue_Month,Issue_Day,Issue_Year,Issue_type,Issue,Description) VALUES(&quot; & &quot;'&quot; & Property_num & &quot;','&quot; & User_name & &quot;','&quot; & Issue_Month & &quot;','&quot; & Issue_Day & &quot;','&quot; & Issue_Year & &quot;','&quot; & Issue_type & &quot;','&quot; & Issue & &quot;','&quot; & Description & &quot;'&quot; & &quot;)

objDB.Close
Set objDB = Nothing

response.redirect &quot;troubleticketconfirmation.asp&quot;

%>
 
Couple of things. First, you need to include the connection string when opening the conn:

Code:
sDBName = &quot;Driver={Microsoft Access Driver (*.mdb)}; DBQ=f:\0ED\artcraftcos.com\files\databases\computer_trouble.mdb;&quot;
Set objDB = Server.CreateObject(&quot;ADODB.Connection&quot;)
objDB.open sDBName

Then you need to put that SQL into a var and execute it:

Code:
strSQL = &quot;INSERT INTO...&quot;

objDB.Execute(strSQL)
--James
 
Thanks guys, I am getting an internal server error now, I am going to check to see if there is an issue with the database. the connection is good because I can get information from the database, just having issues adding records.
 
ok, new peice of code, I am getting a general HTTP 500 - Internal server error. the connection works, all the code works if I comment out the set sqlstmnt line and the execute line, the remaining code functions. am I still missing some errors?


<%

response.buffer = &quot;true&quot;

Property_num=request.querystring(&quot;property&quot;)
User_name=request.querystring(&quot;computer_user&quot;)
Issue_Month=request.querystring(&quot;month&quot;)
Issue_Day=request.querystring(&quot;Day&quot;)
Issue_Year=request.querystring(&quot;Year&quot;)
Issue_type=request.querystring(&quot;issue_type&quot;)
Issue=request.querystring(&quot;specific_Issue&quot;)
Description=request.querystring(&quot;description&quot;)

sDBName = &quot;Driver={Microsoft Access Driver (*.mdb)}; DBQ=f:\0ED\artcraftcos.com\files\databases\computer_trouble.mdb;&quot;
Set objDB = Server.CreateObject(&quot;ADODB.Connection&quot;)
objDB.open sDBName

set sqlstmnt = &quot;INSERT INTO [troubleticket](Property_num,User_name,Issue_Month,Issue_Day,Issue_Year,Issue_type,Issue,Description) VALUES(&quot; & &quot;'&quot; & Property_num & &quot;','&quot; & User_name & &quot;','&quot; & Issue_Month & &quot;','&quot; & Issue_Day & &quot;','&quot; & Issue_Year & &quot;','&quot; & Issue_type & &quot;','&quot; & Issue & &quot;','&quot; & Description & &quot;'&quot; & &quot;)&quot;

objDB.Execute(sqlstmnt)

objDB.Close
Set objDB = Nothing
 
the simple solution is usually the best NadN, thanks.
 
Maybe I have just never used that syntax but I wouldn't 'set' the query string. One of mine looks like:

Code:
sqlString=&quot;SELECT &quot; & FieldList & _
          &quot; FROM PDFList &quot; & _
          &quot; Where  Acct Is Not Null &quot; & _
          &quot; ORDER BY Acct ASC, TimeStamp DESC&quot;
Set DataRs=DataConn.execute(sqlString)

And the suggestion to print the string and if necessary run it manualy is very good advice. That is how I find the space that isn't there or the extra (.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top