Professional Web Applications Themes

Need Help -Expected end of statement - Microsoft SQL / MS SQL Server

I really could use some help with this query... Here is query strTicker = "insert into ticker1 values ('" & request.QueryString("line") & "'), ('" & request.QueryString("text") & "')" ; Here is my error: Error Type: Microsoft VBScript compilation (0x800A0401) Expected end of statement /lab/test/testTicker.asp, line 38, column 125 strTicker = "insert into ticker1 values ('" & request.QueryString("line") & "'), ('" & request.QueryString("text") & "')" ; ---------------------------------------------------------- ---------------------------------------------------------- --------^ Here is the code: % 'Dimension variables Dim adoCon 'Holds the Database Connection Object Dim rsUpdateEntry 'Holds the recordset for the record to be updated Dim strSQL 'Holds the SQL query for ...

  1. #1

    Default Need Help -Expected end of statement


    I really could use some help with this query...

    Here is query
    strTicker = "insert into ticker1 values ('" &
    request.QueryString("line") & "'), ('" &
    request.QueryString("text") & "')" ;

    Here is my error:
    Error Type:
    Microsoft VBScript compilation (0x800A0401)
    Expected end of statement
    /lab/test/testTicker.asp, line 38, column 125
    strTicker = "insert into ticker1 values ('" &
    request.QueryString("line") & "'), ('" &
    request.QueryString("text") & "')" ;
    ----------------------------------------------------------
    ----------------------------------------------------------
    --------^

    Here is the code:

    %
    'Dimension variables
    Dim adoCon 'Holds the Database
    Connection Object
    Dim rsUpdateEntry 'Holds the recordset for the record to
    be updated
    Dim strSQL 'Holds the SQL query
    for the database
    Dim lngRecordNo 'Holds the record number to be
    updated
    Dim BuildType



    'Read in the record number to be updated
    lngRecordNo = CLng(Request.Form("ID_no"))



    'Create an ADO connection odject
    Set adoCon = Server.CreateObject("ADODB.Connection")

    'Set an active connection to the Connection object using
    a DSN-less connection
    adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)};
    DBQ=" & Server.MapPath("ticker.mdb")

    'Create an ADO recordset object
    Set rsUpdateEntry = Server.CreateObject("ADODB.Recordset")

    'Initialise the strSQL variable with an SQL statement to
    query the database
    strTicker = "insert into ticker1 values ('" &
    request.QueryString("line") & "'), ('" &
    request.QueryString("text") & "')" ;



    'Open the tblComments table using the SQL query held in
    the strSQL varaiable
    rsUpdateEntry.Open strTicker, adoCon

    'Update the record in the recordset
    rsUpdateEntry.Fields("line") = request.querystring
    ("line")




    'Write the updated recordset to the database
    rsUpdateEntry.Update

    'Reset server objects
    rsUpdateEntry.Close
    Set rsUpdateEntry = Nothing
    Set adoCon = Nothing


    'Return to the update select page incase another record
    needs deleting
    Response.Redirect "tAdmin.asp"

    %>


    dalethom Guest

  2. #2

    Default Re: Need Help -Expected end of statement

    You have a ; at outside of your " string delimiters.

    You have:
    request.QueryString("text") & "')" ;

    Should be:
    request.QueryString("text") & "');"

    Or just drop the ; altogether.

    Ray at home

    --
    Will trade ASP help for SQL Server help


    "dalethom" <com> wrote in message
    news:07f501c34ce0$d4f272b0$gbl... 
     


    Ray Guest

  3. #3

    Default Re: Need Help -Expected end of statement

    Try looking at the value of strTicker after you assign it:
    It looks to me like it would be (using linevalue and textvalue to represent
    the values or you variables):

    insert into ticker1 values('linevalue'),('textvalue')

    this is not correct SQL, it should be

    insert into ticker1 values('linevalue','textvalue')

    so, changing the "'), ('" to "','" should work

    "dalethom" <com> wrote in message
    news:07f501c34ce0$d4f272b0$gbl... 


    David Guest

Similar Threads

  1. Expected end of statement
    By yls in forum ASP
    Replies: 8
    Last Post: September 15th, 11:53 AM
  2. Expected end of statement
    By mallyonline in forum ASP Components
    Replies: 4
    Last Post: May 30th, 09:55 PM
  3. Expected end of statement
    By onyx23 in forum Dreamweaver AppDev
    Replies: 0
    Last Post: February 16th, 04:19 PM
  4. Expected end of statement
    By onyx23 in forum Dreamweaver AppDev
    Replies: 0
    Last Post: February 16th, 04:06 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139