|
Twopigs -> Is it spaces in Sql that are blocking me? (12/28/2006 9:52:58)
|
Hello all! Once again, i'm down to one small thing that is just killing me. I have select menus populating from an sql database and everything is working fine except for 1 name, the only thing different is that it has a space "Arctic Cat" I had 2 names, "Arctic Cat" and "Gas-Gas" in the database that were messing my code up so I made an if else statement and set a variable: <%If request.querystring("Co_Code")="Arctic Cat" then%>
<%Namefix="Arctic_Cat"%>
<% Else %>
<% If request.querystring("Co_Code")="Gas-Gas" then%>
<%Namefix="Gas_Gas">
<% Else %>
<%Co_Code=request.querystring("Co_Code")%>
<% End If %> Then I made querys on the server called Yamaha_List, Honda_List, Gas_Gas_List, Arctic_Cat_List and checked them, they ran fine. But when I try to pick "Arctic Cat" from the list it just shows up blank? I have a test page up: http://velocityincadmin.com/allballs/test2.asp here's the code calling the list: <%
if Namefix<>"" then
sql="SELECT DISTINCT Model_No FROM "&Namefix&"_list WHERE veh_type='"& veh_type & "' ORDER by Model_No"
set rs=Server.CreateObject("ADODB.Recordset")
rs.Open sql,conn%>
<form method="get">
Choose Model NF <select name="Model_No">
<% do until rs.EOF
response.write("<option")
if rs.fields("Model_No")=Model_No then
response.write(" selected")
end if
response.write(">")
response.write(rs.fields("Model_No"))
rs.MoveNext
loop
rs.Close
set rs=Nothing %>
</select>
<input type="submit" value="Set Vehicle">
</form> P.S. the Veh_Type is either ATV, OR, UTV, ST I made a page and just hard coded Arctic_Cat_List and it works? here is the code for that page: <%
Dim veh_type
veh_type="ATV"
Set conn = Server.CreateObject("ADODB.Connection")
conn.ConnectionString = "PROVIDER=SQLOLEDB;SERVER=67.59.176.188;UID=uname;" & _
"PWD=password;DATABASE=theDatabase"
conn.Open
set rs=Server.CreateObject("ADODB.recordset")
sql="SELECT DISTINCT Model_No FROM Arctic_Cat_List WHERE veh_type='"& veh_type & "' ORDER by Model_No"
rs.Open sql,conn
%>
<form method="post">
Choose Customer <select name="Model_No">
<% do until rs.EOF
response.write("<option")
if rs.fields("Model_No")=Co_Code then
response.write(" selected")
end if
response.write(">")
response.write(rs.fields("Model_No"))
rs.MoveNext
loop
rs.Close
set rs=Nothing %>
</select>
<input type="submit" value="Show Models">
</form> here's that page: http://velocityincadmin.com/allballs/test.asp As always thanks a ton for any help
|
|
|
|