End of statement expected

Results 1 to 2 of 2

Thread: End of statement expected

  1. #1
    Curt Precilla Guest

    Default End of statement expected

    Hi<BR><BR>I have just gone through two tutorials on connecting a web page to a database. After a lot of head scratching I coded the two pages necessary for my simple operation.<BR><BR>The first page is a HTML form that captures six values and uses the method=post attribute to forward these values to an asp page. The asp page is simply used to insert this data into an Access Database.<BR><BR>When I try the page I get the following error:<BR><BR>Microsoft VBScript compilation error &#039 800a0401&#039 <BR>Expected end of statement <BR>/thanks.asp, line 12 <BR><BR>This is followed by the offending line of code. Can anybody tell me what I am doing wrong? The code I used is shown below:<BR><BR>&#060;%<BR>&#039This section retrieves the values submitted in the form<BR><BR>location=Request.Form("area")<BR>act=R equest.Form("use")<BR>trys=Request.Form("attempts" )<BR>rates=Request.Form("speed")<BR>serve=Request. Form("service")<BR>comm=Request.Form("comments")<B R><BR>&#039Opens connection with the database<BR><BR>Dim objConn<BR>Set objConn=Server.CreateObject("ADODB.Connection")<BR >objConn.ConnectionString="DSN=feedback2"<BR>objCo nn.Open<BR><BR>&#039Inserts form values into database<BR><BR>INSERT INTO Feedback (area, use, attempts, speed, service, comments) <BR>VALUES (location, act, trys, rates, serve, comm)<BR><BR>Closes connection with database<BR><BR>objConn.close<BR>%&#062;<BR><BR>Th anks you for your help.<BR>Yours Sincerely<BR>Curt Precilla<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: End of statement expected

    You have to put your insert statement into a string and parse the ASP variable values into that string and execute that string:<BR><BR>str = "INSERT INTO feedback (area, use, attempts, speed, service, comments) VALUES(&#039" & location & "&#039,&#039" & act & "&#039,&#039" & trys & "&#039,&#039" & rates & "&#039,&#039" & serve & "&#039,&#039" & comm & "&#039)"<BR><BR>objConn.Execute (sql)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts