|
-
Jan 5th, 2001, 12:42 PM
#1
Thread Starter
Junior Member
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, 02:44 PM
#2
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, 02:45 PM
#3
This did not display well, so I should clarify that '' is actually two single quotes.
-
Jan 5th, 2001, 02:52 PM
#4
Thread Starter
Junior Member
pardon?
could you please expand further?
the code will onyl update/edit the first and last record
-
Jan 5th, 2001, 03:00 PM
#5
Have you done debug.print on strSQL?
Do that, then copy the results into Query analyzer and try to run the query that way.
-
Jan 5th, 2001, 03:16 PM
#6
Thread Starter
Junior Member
query analyzer?
Can't say I have one of them
debug.print strSQL would go where? anywhere?
-
Jan 5th, 2001, 03:21 PM
#7
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.
-
Jan 5th, 2001, 03:28 PM
#8
Thread Starter
Junior Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|