Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jul 2005
    Location
    Oxfordshire, UK
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Expected identifier

    i am getting this error:

    Error Type:
    Microsoft VBScript compilation (0x800A03F2)
    Expected identifier
    /quest/add.asp, line 10, column 4

    when submitting my form.

    the code for the add.asp page is:

    Code:
    <%@ Language="VBScript" %>
    <% Option Explicit %> 
    <html>
    <head>
    <title>Form to database</title>
    </head>
    <body> 
    <%
    'declare your variables
    Dim 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20
    Dim 21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37
    Dim 38,39,40,41,42,43,44,45,46,47,48,49
    
    Dim sConnString, connection, sSQL
    'Receiving values from Form, assign the values entered to variables
    1=request.form("1")
    2=request.form("2")
    3=request.form("3")
    4=request.form("4")
    5=request.form("5")
    6=request.form("6")
    7=request.form("7")
    8=request.form("8")
    9=request.form("9")
    10=request.form("10")
    11=request.form("11")
    12=request.form("12")
    13=request.form("13")
    14=request.form("14")
    15=request.form("15")
    16=request.form("16")
    17=request.form("17")
    18=request.form("18")
    19=request.form("19")
    20=request.form("20")
    21=request.form("21")
    22=request.form("22")
    23=request.form("23")
    24=request.form("24")
    25=request.form("25")
    26=request.form("26")
    27=request.form("27")
    28=request.form("28")
    29=request.form("29")
    30=request.form("30")
    31=request.form("31")
    32=request.form("32")
    33=request.form("33")
    34=request.form("34")
    35=request.form("35")
    36=request.form("36")
    37=request.form("37")
    38=request.form("38")
    39=request.form("39")
    40=request.form("40")
    41=request.form("41")
    42=request.form("42")
    43=request.form("43")
    44=request.form("44")
    45=request.form("45")
    46=request.form("46")
    47=request.form("47")
    48=request.form("48")
    49=request.form("49")
    
    'declare SQL statement that will query the database 
    sSQL = "INSERT into data (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) values ('" & _
    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 & "')" 
    'define the connection string, specify database
    'driver and the location of database
    sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _ 
    "Data Source=" & Server.MapPath("questionnaire.mdb") 
    'create an ADO connection object 
    Set connection = Server.CreateObject("ADODB.Connection")
    
    'Open the connection to the database
    connection.Open(sConnString)
    
    'execute the SQL 
    connection.execute(sSQL)
    
    response.redirect "thanks.htm"
    'Done. Close the connection object
    connection.Close
    Set connection = Nothing
    %>
    </body>
    </html>
    is there a limit to the number of things you can post?

    i have used this script before and its working but i have changed the values etc and now i get that above error!

    HELP!

  • #2
    Regular Coder
    Join Date
    May 2005
    Location
    Michigan, USA
    Posts
    566
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by robojob
    Code:
    Dim 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20
    Dim 21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37
    Dim 38,39,40,41,42,43,44,45,46,47,48,49
    You cannot do that. Variables must start with an alpha character.
    Note: I do not test code. I just write it off the top of my head. There might be bugs in it! But if any thing I gave you the overall theory of what you need to accomplish. Also there are plenty of other ways to accomplish this same thing. I just gave one example of it. Other ways might be faster and more efficient.


  •  

    Posting Permissions

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