Results 1 to 8 of 8

Thread: hard coded drop down(s)

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2000
    Posts
    29

    Exclamation

    I have a table called used_cars and have a drop down called sub model that is hard coded with all the sub models available sow how do you update the dB? the values are being save into a table called used_category field name description?

    this is the start of my SQL
    If Request.Form("save")="save" then
    If VehicleID = 0 Then
    strSQL = "Insert Into used_cars (CategoryID, year, make, model, kms, stocknumber, color, price, enginesize, additional, seatingcapacity,submodel) values ("
    strSQL = strSQL & CategoryID & ","
    strSQL = strSQL & Request.Form("year") & ","
    continue strSQL for make,model etc.
    strSQL = strSQL & AddSQLQuotes(Request.Form("submodel"), "'") & ")"

    this is JUST an example of my drop down
    <select name="submodel">
    option value="base" selected>Base</option>
    <option value="Cargo">Cargo</option>
    <option value="CL">CL</option>
    </select>
    and finally this is my error message

    Microsoft OLE DB Provider for SQL Server error ' 80040e14'

    There are fewer columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.

    /test/newlayout2.asp, line 64

    line 64 is this dbData.Execute strSQL

    do i have to insert every single submodel of every single model of car??? is there not an easier way of doing this?
    how do i make sure when i want to edit the record the proper dropdown value is listed???

  2. #2
    Guest
    You need to provide a value for each of these:

    CategoryID, year, make, model, kms, stocknumber, color, price, enginesize, additional, seatingcapacity,submodel


    If there is not anything you wish to add to one of the columns, either remove that column from the insert statement, or add '' to the values.

  3. #3
    Guest
    This did not display well, so I should clarify that '' is actually two single quotes.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Dec 2000
    Posts
    29

    pardon?

    could you please expand further?

    the code will onyl update/edit the first and last record

  5. #5
    Guest
    Have you done debug.print on strSQL?

    Do that, then copy the results into Query analyzer and try to run the query that way.

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Dec 2000
    Posts
    29

    query analyzer?

    Can't say I have one of them

    debug.print strSQL would go where? anywhere?

  7. #7
    Guest
    Query analyzer comes with SQL server 7. If you are using 6.5, it is Isqlw, if you are using less than 6.5, you need to upgrade.

    Debug.Print shows in the immedidate window.

    In your code, after you have built strSQL, write Debug.Print strSQL, and the actual query string will appear in the immediate window. If you don't have the immediate window open, it will open automatically, usually at the bottom of the VB window.

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Dec 2000
    Posts
    29

    problem with that

    I am building this page here at work and the dB is hosted eleswhere so what I ahve to do is ftp the page up to the server to test it -- make sense? I am using a demo copy of allaire right now to build everything. I do not have the resources to get visual studio or some other program and furthermore, I am not very familiar with SQL so that is why all the questions

Posting Permissions

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



Click Here to Expand Forum to Full Width