|
-
Dec 12th, 2000, 12:25 PM
#1
Thread Starter
Junior Member
this is the code that i am working with......what it is doin is populating the listbox with the same value when it should be only once and secondly i am getting a type mismatch error. Can someone please be thourough with their explanation as to where I am making my mistake.
<%
Option Explicit
Dim dbData
Dim rsData
Dim strSQL
Dim rsOptions
Dim CategoryID
Dim VehicleID
Dim numincol
Dim i
Dim selected
selected=false
set dbData = Server.CreateObject("ADODB.Connection")
dbData.Open Application("DSN")
If Request.Form("VehicleID") = vbNullString Then
CategoryID = 0
Else
If Request.Form("VehicleID") = 1 Then
CategoryID = 2
ElseIf Request.Form("VehicleID") = 2 Then
CategoryID = 1
End If
End If
If Request.Form("VehicleList") = vbNullString Then
VehicleID = 0
Else
VehicleID = Request.Form("VehicleList")
End If
'Connection to Database
Set dbData = Server.CreateObject("ADODB.Connection")
dbData.Open Application("DSN")
'Connection to Recordsets
strSQL = "SELECT ID, Description FROM used_options"
strSQL = strSQL & " Order by Description"
Set rsOptions = Server.CreateObject("ADODB.Recordset")
rsOptions.Open strSQL, dbData, 1, 3
strSQL = "SELECT * From used_cars"
strSQL = strSQL & " INNER JOIN used_category ON used_cars.CategoryID = used_category.ID"
strSQL = strSQL & " INNER JOIN used_car_options ON used_cars.CarID = used_car_options.CarID"
strSQL = strSQL & " INNER JOIN used_options ON used_car_options.OptionID = used_options.ID"
strSQL = strSQL & " WHERE CategoryID = " & CategoryID 'AND used_cars.CarID = " & VehicleID
Set rsData = Server.CreateObject("ADODB.Recordset")
rsData.Open strSQL, dbData, 1, 3
%>
<html>
<head>
</head>
<form name="frmUsed" action="newlayout.asp" method="post">
<table cellSpacing="0" cellPadding="0" width="750px" border="1" align="center">
<tr><td colSpan="5"><center>Select the appropriate vehicle type to add to the inventory:</center>
/td></tr>
<tr><table width="594" align="center">
<td>
<input type="image" onclick="this.form.VehicleID.value=1;" src="../images/used_images/truck1.jpg">Truck</td>
<td>
<inputmtype="image"onclick="this.form.VehicleID.value=2;" src="../images/used_images/car1.jpg">Car</td> <input type="hidden" name="VehicleID">
</td></tr></table>
<font face="arial" size="5" color="#ff0000"><strong><em>
<%If Request.Form("VehicleID") = 1 Then%>
Trucks
<%ElseIf Request.Form("VehicleID") = 2 Then%>
Cars
<%End If%>
<table border="1" cellpadding="10" cellspacing="0" bgcolor="c0c0c0" bordercolor="#000000" width="594" align="center">
<tr><td colspan="2" align="center">
<select size="10" name="VehicleList"
onchange="document.frmUsed.submit()">
<option>--------------------------------------------- New Listing ---------------------------------------------</option>
<%If Not rsData.BOF Then rsData.MoveFirst
Do Until rsData.EOF%>
<option value="<%=rsData.Fields("CarID")%>"><%=rsData.Fields("Make")%></option> *This gives type mismatch if i change to VehicleID but if it stays as is i get more than one record for the same thing.
<%rsData.MoveNext
Loop%>
</select>
</td>
</tr>
<tr>
<td>
<font face="arial" size="2">Make</font> <input type="text" name="Make" value="<%'if selected then Response.Write("value='" & rsData.Fields("Make") & "'") end if%>"> *THIS WONT POPULATE =( *
</td>
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
|