PDA

Click to See Complete Forum and Search --> : hard coded drop down(s)


rigpig
Jan 5th, 2001, 11:42 AM
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???

Jan 5th, 2001, 01:44 PM
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.

Jan 5th, 2001, 01:45 PM
This did not display well, so I should clarify that '' is actually two single quotes.

rigpig
Jan 5th, 2001, 01:52 PM
could you please expand further?

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

Jan 5th, 2001, 02:00 PM
Have you done debug.print on strSQL?

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

rigpig
Jan 5th, 2001, 02:16 PM
Can't say I have one of them

debug.print strSQL would go where? anywhere?

Jan 5th, 2001, 02:21 PM
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.

rigpig
Jan 5th, 2001, 02:28 PM
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