navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

Is it spaces in Sql that are blocking me?

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Is it spaces in Sql that are blocking me?
Page: [1]
 
Twopigs

 

Posts: 147
Joined: 8/22/2002
Status: offline

 
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
rdouglass

 

Posts: 9227
From: Biddeford, ME USA
Status: offline

 
RE: Is it spaces in Sql that are blocking me? - 12/28/2006 10:02:09   
quote:

here's that page: http://velocityincadmin.com/allballs/test.asp


The dropdown on that page needs closing tags </option> on each item. You need to add the apropriate response.write to your loop.

The test2 page is the same. It (the dropdown) doesn't know when the value stops or starts. Add that tag to both menus and see if that helps.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to Twopigs)
Twopigs

 

Posts: 147
Joined: 8/22/2002
Status: offline

 
RE: Is it spaces in Sql that are blocking me? - 12/28/2006 10:16:25   
LOL, I knew you would answer... :) I thank you for all your help. You've gotten me out of many corners! :)

Well, I put the tags in but no luck, still that Arctic Cat thing is messing with me. I have a feeling i'll stumble on it. I'll let you know what i find. I'm going to switch gears and maybe clear the head. I worked on it all day yesterday. I'm not going to let it beat me though! :)

It shouldn't have anything to do with the space being that i'm assigning the variable Arctic_Cat ? and I even have it writing at the bottom just to make sure it's setting the variable correctly. it's strange that Gas-Gas converts and works fine but that other one doesn't? I'll get it... Thanks again!

(in reply to rdouglass)
rdouglass

 

Posts: 9227
From: Biddeford, ME USA
Status: offline

 
RE: Is it spaces in Sql that are blocking me? - 12/28/2006 10:24:19   
quote:

still that Arctic Cat thing is messing with me.


Do you have a page with the dropdowns correct?? Maybe I can take a quick peek again?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to Twopigs)
Twopigs

 

Posts: 147
Joined: 8/22/2002
Status: offline

 
RE: Is it spaces in Sql that are blocking me? - 12/28/2006 10:32:53   
Here is the whole page...i'm always afraid to put them up because I can hear the "experts" saying "WHAT IN THE WORLD IS THIS GUY DOING??" but that's why I come here :)

This is: http://velocityincadmin.com/allballs/test1.asp
<%@ language="vbscript"%>
<html>
<body>

<%If request.querystring("Co_Code")="Arctic Cat" then%>
<%'response.write("it's reading that the name is Arctic Cat")%>
<%Namefix="Arctic_Cat"
Nameoption="Arctic Cat"%>
<% Else %>
<% If request.querystring("Co_Code")="Gas-Gas" then%>
<%'response.write("it's reading that the name is Gas-Gas")%>
<%Namefix="Gas_Gas"
Nameoption="Gas-Gas"%>
<% Else %>
<%Co_Code=request.querystring("Co_Code")%>
<% End If %>
<%
veh_type=request.querystring("veh_type")
veh_year=request.querystring("veh_year")
Model_No=request.querystring("Model_No")
%>
<%
  Set conn = Server.CreateObject("ADODB.Connection")
  conn.ConnectionString = "PROVIDER=SQLOLEDB;SERVER=67.59.176.188;UID=uname;" & _
                                  "PWD=password;DATABASE=ALLBALLS"
conn.Open

set rs=Server.CreateObject("ADODB.recordset")
sql="SELECT DISTINCT veh_type FROM Vehicle ORDER BY veh_type"
rs.Open sql,conn
%>

<form method="get">
Choose Vehicle Type <select name="veh_type">
<%  do until rs.EOF
    response.write("<option")
    if rs.fields("veh_type")=veh_type then
      response.write(" selected")
    end if
    response.write(">")
    response.write(rs.fields("veh_type"))
    rs.MoveNext
loop
response.write("</option>")
rs.Close
set rs=Nothing %>
</select>
<input type="submit" value="Show Models">
</form>
<%
if veh_type<>"" then
   sql="SELECT DISTINCT veh_year FROM " & veh_type & "_list ORDER by veh_year DESC"
   set rs=Server.CreateObject("ADODB.Recordset")
   rs.Open sql,conn
%>
   <form method="get">
Choose Year <select name="veh_year">
<%  do until rs.EOF
    response.write("<option")
	  if rs.fields("veh_year")=veh_year then
      response.write(" selected")
    end if
    response.write(">")
    response.write(rs.fields("veh_year"))
    rs.MoveNext
loop
response.write("</option>")
rs.Close
set rs=Nothing %>
</select>
<input type="submit" value="Show Makes">
<input type="hidden" name="veh_type" value=<%response.write(veh_type)%>>
</form>
<% End If %>
<%
if veh_year<>"" then
   sql="SELECT DISTINCT Co_Code FROM " & veh_type & "_list"
   set rs=Server.CreateObject("ADODB.Recordset")
   rs.Open sql,conn
%>
   <form method="get">
Choose Make <select name="Co_Code">
<%  do until rs.EOF
    response.write("<option")
	  if rs.fields("Co_Code")=Co_Code or rs.fields("Co_Code")=Nameoption then
      response.write(" selected")
    end if
    response.write(">")
    response.write(rs.fields("Co_Code"))
    rs.MoveNext
loop
rs.Close
set rs=Nothing %>
</select>
<input type="hidden" name="veh_type" value=<%response.write(veh_type)%>>
<input type="hidden" name="veh_year" value=<%response.write(veh_year)%>>
<input type="submit" value="Show Models">
</form>
<% End If %>
<%
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
response.write("</option>")
rs.Close
set rs=Nothing %>
</select>
<input type="hidden" name="veh_type" value=<%response.write(veh_type)%>>
<input type="hidden" name="veh_year" value=<%response.write(veh_year)%>>
<input type="hidden" name="Co_Code" value=<%response.write(Namefix)%>>
<input type="submit" value="Set Vehicle">
</form>
<% Else  %>
<%
if Co_Code<>"" then
   sql="SELECT DISTINCT Model_No FROM " & Co_Code & "_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 <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
response.write("</option>")
rs.Close
set rs=Nothing %>
</select>
<input type="hidden" name="veh_type" value=<%response.write(veh_type)%>>
<input type="hidden" name="veh_year" value=<%response.write(veh_year)%>>
<input type="hidden" name="Co_Code" value=<%response.write(Co_code)%>>
<input type="submit" value="Set Vehicle">
</form>
<% End If %>
<% End If %>
<% End If %>
Veh_Type: <%response.write(veh_type)%><br>
Veh_Year: <%response.write(veh_year)%><br>
Co_Code: <%response.write(Co_Code)%><br>
Vehicle Make(Namefix): <%response.write(Namefix)%><br>
Vehicle Model(Model_No): <%response.write(Model_No)%><br>
</table>

</body>
</html>

(in reply to rdouglass)
Twopigs

 

Posts: 147
Joined: 8/22/2002
Status: offline

 
RE: Is it spaces in Sql that are blocking me? - 12/28/2006 10:35:02   
P.S. This was my work around to the Java script. So i'm sure it's got it's flaws. I thought it might run a bit faster being that it's calling from stored database views on the server.

(in reply to Twopigs)
BeTheBall

 

Posts: 6359
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Is it spaces in Sql that are blocking me? - 12/28/2006 10:40:44   
Try this:

<% do until rs.EOF
response.write("<option value='"& rs.fields("Model_No") &"'")
if rs.fields("Model_No")=Co_Code then
response.write(" selected")
end if
response.write(">")
response.write(rs.fields("Model_No"))
response.write("</option>")
rs.MoveNext

I have seen users miss putting their option values in quotes and then have problems when the value has a space in it. I am guessing the same holds true when you try to use this syntax:

<option>option value</option>

instead of:

<option value="option value">option value</option>

You would need to add a value attribute to any and all dropdowns.

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to Twopigs)
Twopigs

 

Posts: 147
Joined: 8/22/2002
Status: offline

 
RE: Is it spaces in Sql that are blocking me? - 12/28/2006 11:07:24   
Bummer, I was all excited thinking that might have been it... to no avail. Nice though, I overlooked that. I did run into that problem before and setting the value did help. I'll keep pluggin away. :) Thanks though!

(in reply to BeTheBall)
Spooky

 

Posts: 26599
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Is it spaces in Sql that are blocking me? - 12/28/2006 13:29:25   
Try this? I think you have an "end if" in the wrong place.
Also, Id be using POST and youll want to check the inputs (at a minimum) for quote characters

<%@ language="vbscript"%>
<html>
<body>


<%
Co_Code=request.querystring("Co_Code")
veh_type=request.querystring("veh_type")
veh_year=request.querystring("veh_year")
Model_No=request.querystring("Model_No")


  Set conn = Server.CreateObject("ADODB.Connection")
  conn.ConnectionString = "PROVIDER=SQLOLEDB;SERVER=67.59.176.188;UID=uname;" & _
                                  "PWD=password;DATABASE=ALLBALLS"
conn.Open

set rs=Server.CreateObject("ADODB.recordset")
sql="SELECT DISTINCT veh_type FROM Vehicle ORDER BY veh_type"
rs.Open sql,conn
%>

<form method="get">
Choose Vehicle Type <select name="veh_type">
<%  do until rs.EOF
    response.write("<option value="""&rs.fields("veh_type")&"""")
    if rs.fields("veh_type")=veh_type then
      response.write(" selected")
    end if
    response.write(">")
    response.write(rs.fields("veh_type"))
    rs.MoveNext
loop
response.write("</option>")
rs.Close
set rs=Nothing %>
</select>
<input type="submit" value="Show Models">
</form>





<%
if veh_type<>"" then
   sql="SELECT DISTINCT veh_year FROM " & veh_type & "_list ORDER by veh_year DESC"
   set rs=Server.CreateObject("ADODB.Recordset")
   rs.Open sql,conn
%>
   <form method="get">
Choose Year <select name="veh_year">
<%  do until rs.EOF
    response.write("<option """&rs.fields("veh_year")&"""")
	  if rs.fields("veh_year")=veh_year then
      response.write(" selected")
    end if
    response.write(">")
    response.write(rs.fields("veh_year"))
    rs.MoveNext
loop
response.write("</option>")
rs.Close
set rs=Nothing %>
</select>
<input type="submit" value="Show Makes">
<input type="hidden" name="veh_type" value=<%response.write(veh_type)%>>
</form>
<% End If %>




<%
if veh_year<>"" then
   sql="SELECT DISTINCT Co_Code FROM " & veh_type & "_list"
   set rs=Server.CreateObject("ADODB.Recordset")
   rs.Open sql,conn
%>
   <form method="get">
Choose Make <select name="Co_Code">
<%  do until rs.EOF
    response.write("<option """&rs.fields("Co_Code")&"""")
	  if rs.fields("Co_Code")=Co_Code or rs.fields("Co_Code")=Nameoption then
      response.write(" selected")
    end if
    response.write(">")
    response.write(rs.fields("Co_Code"))
    rs.MoveNext
loop
rs.Close
set rs=Nothing %>
</select>
<input type="hidden" name="veh_type" value=<%response.write(veh_type)%>>
<input type="hidden" name="veh_year" value=<%response.write(veh_year)%>>
<input type="submit" value="Show Models">
</form>
<% End If %>



<%
if Co_Code<>"" then
   sql="SELECT DISTINCT Model_No FROM " & Co_Code & "_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 <select name="Model_No">
<%  do until rs.EOF
    response.write("<option """&rs.fields("Model_No")&"""")
	  if rs.fields("Model_No")=Model_No then
      response.write(" selected")
    end if
    response.write(">")
    response.write(rs.fields("Model_No"))
    rs.MoveNext
loop
response.write("</option>")
rs.Close
set rs=Nothing %>
</select>
<input type="hidden" name="veh_type" value=<%response.write(veh_type)%>>
<input type="hidden" name="veh_year" value=<%response.write(veh_year)%>>
<input type="hidden" name="Co_Code" value=<%response.write(Co_code)%>>
<input type="submit" value="Set Vehicle">
</form>
<% End If %>




Veh_Type: <%response.write(veh_type)%><br>
Veh_Year: <%response.write(veh_year)%><br>
Co_Code: <%response.write(Co_Code)%><br>
Vehicle Make(Namefix): <%response.write(Namefix)%><br>
Vehicle Model(Model_No): <%response.write(Model_No)%><br>
</table>

</body>
</html>



_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to Twopigs)
Twopigs

 

Posts: 147
Joined: 8/22/2002
Status: offline

 
RE: Is it spaces in Sql that are blocking me? - 12/28/2006 13:40:02   
Thanks Spooky!...I made a new page...Test3.asp and pasted that code, it's giving me the error I had before I messed with the code.

It's from Arctic Cat having a space.

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

Invalid object name 'Arctic'.

/allballs/test3.asp, line 106

http://velocityincadmin.com/allballs/test3.asp


The database it needs to call is Arctic Cat_List

I am probalby missing one of those quotes? Not sure where though?

(in reply to Spooky)
Spooky

 

Posts: 26599
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Is it spaces in Sql that are blocking me? - 12/28/2006 13:50:03   
On line 104, change this code :

Co_Code

to this :

replace(Co_Code," ","-")

The database name is "Arctic-Cat_list" ? You have a separate database for each make?

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to Twopigs)
Twopigs

 

Posts: 147
Joined: 8/22/2002
Status: offline

 
RE: Is it spaces in Sql that are blocking me? - 1/2/2007 13:30:05   
Sooooo close... I have a feeling someone will get this...
i've tried everything though?

It's giving me this error:
ADODB.Recordset error '800a0bb9'

Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

/allballs/test3.asp, line 139

Here is the code at the top of my page setting the variables:
<%If request.form("Co_Code")="Arctic Cat" then%>
<%Namefix="ArcticCat"
Nameoption="Arctic Cat"%>
<% Else %>
<% If request.form("Co_Code")="Gas-Gas" then%>
<%Namefix="Gas_Gas"
Nameoption="Gas-Gas"%>
<% Else %>
<%Co_Code=request.form("Co_Code")%>
<% End If %>

<%
veh_type=request.form("veh_type")
veh_year=request.form("veh_year")
Model_No=request.form("Model_No")

and here is line the code from line 135 to line 140:
<%
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
%>


The name of the actual database view is ArcticCat_list (I got rid of the space incase that was the issue.) Any ideas for that error? What's really strange is the Gas-Gas one works perfect?

(in reply to Spooky)
Spooky

 

Posts: 26599
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Is it spaces in Sql that are blocking me? - 1/2/2007 13:43:45   
What does this give you?

   sql="SELECT DISTINCT Model_No FROM " & Namefix & "_list WHERE veh_type='"& veh_type & "' ORDER by Model_No"
response.write  sql
response.end

   set rs=Server.CreateObject("ADODB.Recordset")


_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to Twopigs)
Twopigs

 

Posts: 147
Joined: 8/22/2002
Status: offline

 
RE: Is it spaces in Sql that are blocking me? - 1/2/2007 13:53:07   
ahhhh... it's showing that veh_type isn't coming in?

SELECT DISTINCT Model_No FROM ArcticCat_list WHERE veh_type='' ORDER by Model_No

still confused on why it wouldn't bring that over when all the others do?

believe it or not, I didn't even thing to do a response.write to see what was actually going on! So I thank you there...

(in reply to Spooky)
Spooky

 

Posts: 26599
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Is it spaces in Sql that are blocking me? - 1/2/2007 14:05:53   
The next step would be to look at the browser source code to see where veh_type is not passed to the next page
Make sure the hidden inputs are quoted too :

<input type="hidden" name="veh_type" value="<%response.write(veh_type)%>">
<input type="hidden" name="veh_year" value="<%response.write(veh_year)%>">
<input type="hidden" name="Co_Code" value="<%response.write(Co_code)%>">


_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to Twopigs)
Twopigs

 

Posts: 147
Joined: 8/22/2002
Status: offline

 
RE: Is it spaces in Sql that are blocking me? - 1/2/2007 15:13:00   
Cool... I think I see where there might be a problem. of course I just got pulled to another job. I hope i'm not alone in the fact that I can't multi task when programming? I get all this stuff in my head then get called to another job and it's like someone wiped my RAM clean and I am rebooting again...arrgh. I really appreciate all your help, Atleast I have a direction to look in now. I'll get it! :) I reply when I do!

Thanks again!:)

(in reply to Spooky)
Twopigs

 

Posts: 147
Joined: 8/22/2002
Status: offline

 
RE: Is it spaces in Sql that are blocking me? - 1/3/2007 16:03:21   
I tried a small test being that the only thing different is that there is a space in the feild value "Arctic Cat". So I went into the database and changed about 6 records to "ArcticCat" and when I chose one from the list, it brought over the veh_type? but it won't when you pick "Arctic Cat"? Does anyone know what that would be called? Namespaces? Field value spaces? I can't find anything online about it? Thanks in advance!
Scott

(in reply to Twopigs)
Spooky

 

Posts: 26599
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Is it spaces in Sql that are blocking me? - 1/3/2007 16:24:48   
Can you show us again the current code?

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to Twopigs)
Twopigs

 

Posts: 147
Joined: 8/22/2002
Status: offline

 
RE: Is it spaces in Sql that are blocking me? - 1/3/2007 16:30:07   
Sure! Thanks for checking it out here is the whole page:
<%@ language="vbscript"%>
<html>
<body>

<%If request.form("Co_Code")="Arctic Cat" then%>
<%Namefix="ArcticCat"
Nameoption="Arctic Cat"
%>
<% Else %>
<% If request.form("Co_Code")="Gas-Gas" then%>
<%Namefix="GasGas"
Nameoption="Gas-Gas"%>
<% Else %>
<%Co_Code=request.form("Co_Code")%>
<% End If %>
<%
veh_type=request.form("veh_type")
veh_year=request.form("veh_year")
Model_No=request.form("Model_No")
response.write(veh_type)
response.write(veh_year)%>
<%

  Set conn = Server.CreateObject("ADODB.Connection")
  conn.ConnectionString = "PROVIDER=SQLOLEDB;SERVER=67.59.176.188;UID=------;" & _
                                  "PWD=-------;DATABASE=------"
conn.Open

set rs=Server.CreateObject("ADODB.recordset")
sql="SELECT DISTINCT veh_type FROM Vehicle ORDER BY veh_type"
rs.Open sql,conn
%>

<form method="post">
Choose Vehicle Type <select name="veh_type">
<%  do until rs.EOF
    response.write("<option value="""&rs.fields("veh_type")&"""")
    if rs.fields("veh_type")=veh_type then
      response.write(" selected")
    end if
    response.write(">")
    response.write(rs.fields("veh_type"))
    rs.MoveNext
loop
response.write("</option>")
rs.Close
set rs=Nothing %>
</select>
<input type="submit" value="Show Models">
</form>
<% End If %>

<%
if veh_type<>"" then
   sql="SELECT DISTINCT veh_year FROM " & veh_type & "_list ORDER by veh_year DESC"
   set rs=Server.CreateObject("ADODB.Recordset")
   rs.Open sql,conn
%>
   <form method="post">
Choose Year <select name="veh_year">
<%  do until rs.EOF
    response.write("<option """&rs.fields("veh_year")&"""")
	  if rs.fields("veh_year")=veh_year then
      response.write(" selected")
    end if
    response.write(">")
    response.write(rs.fields("veh_year"))
    rs.MoveNext
loop
response.write("</option>")
rs.Close
set rs=Nothing %>
</select>
<input type="submit" value="Show Makes">
<input type="hidden" name="veh_type" value="<%response.write(veh_type)%>">
</form>
<% End If %>




<%
if veh_year<>"" then
   sql="SELECT DISTINCT Co_Code FROM " & veh_type & "_list WHERE veh_year='"& veh_year & "' ORDER by Co_Code"
   set rs=Server.CreateObject("ADODB.Recordset")
   rs.Open sql,conn
%>
   <form method="post">
Choose Make <select name="Co_Code">
<%  do until rs.EOF
    response.write("<option """&rs.fields("Co_Code")&"""")
	  if rs.fields("Co_Code")=Co_Code or rs.fields("Co_Code")=Nameoption then
      response.write(" selected")
    end if
    response.write(">")
    response.write(rs.fields("Co_Code"))
    rs.MoveNext
loop
rs.Close
set rs=Nothing %>
</select>
<input type="text" name="veh_type" value="<%response.write(veh_type)%>">
<input type="text" name="veh_year" value="<%response.write(veh_year)%>">
<input type="submit" value="Show Models">
</form>
<% End If %>



<%
if Co_Code<>"" then
   sql="SELECT DISTINCT Model_No FROM " & Co_Code & "_list WHERE veh_type='"& veh_type & "' ORDER by Model_No"
   set rs=Server.CreateObject("ADODB.Recordset")
   rs.Open sql,conn
%>
   <form method="post">
Choose Model <select name="Model_No">
<%  do until rs.EOF
    response.write("<option """&rs.fields("Model_No")&"""")
	  if rs.fields("Model_No")=Model_No then
      response.write(" selected")
    end if
    response.write(">")
    response.write(rs.fields("Model_No"))
    rs.MoveNext
loop
response.write("</option>")
rs.Close
set rs=Nothing %>
</select>
<input type="text" name="veh_type" value="<%response.write(veh_type)%>">
<input type="text" name="veh_year" value="<%response.write(veh_year)%>">
<input type="text" name="Co_Code" value="<%response.write(Co_code)%>">
<input type="submit" value="Set Vehicle">
</form>
<% End If %>

<%
if Namefix<>"" then
   sql="SELECT DISTINCT Model_No FROM " & Namefix & "_list WHERE veh_type='"& veh_type & "' ORDER by Model_No"%>
<%
response.write  sql
response.end


set rs=Server.CreateObject("ADODB.Recordset")
%>



Veh_Type: <%response.write(veh_type)%><br>
Veh_Year: <%response.write(veh_year)%><br>
Co_Code: <%response.write(Co_Code)%><br>
Vehicle Make(Namefix): <%response.write(Namefix)%><br>
Vehicle Model(Model_No): <%response.write(Model_No)%><br>
</table>
<% End If %>
</body>
</html>

(in reply to Spooky)
Spooky

 

Posts: 26599
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Is it spaces in Sql that are blocking me? - 1/3/2007 18:07:36   
With your current code, Arcticcat works and it only fails on gas-gas?
I get the error :
Invalid object name 'Gas_Gas_list'.

IS that the correct view / table name?

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to Twopigs)
Twopigs

 

Posts: 147
Joined: 8/22/2002
Status: offline

 
RE: Is it spaces in Sql that are blocking me? - 1/3/2007 18:14:27   
Sorry Spooky... Did I give you the right link?
It should be: http://velocityincadmin.com/allballs/test3.asp

I fixed the table name to GasGas (when I was troubleshooting I got rid of the underscores) I changed the Namefix variable too. So it sets it to GasGas.

You'll see text on the page as you select menus, that's just so I know it's carrying the variable over. :)

(in reply to Spooky)
Spooky

 

Posts: 26599
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Is it spaces in Sql that are blocking me? - 1/3/2007 18:20:10   
Youve got 2 arctic cat selections and the second one seems to work ok?

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to Twopigs)
Twopigs

 

Posts: 147
Joined: 8/22/2002
Status: offline

 
RE: Is it spaces in Sql that are blocking me? - 1/3/2007 18:53:35   
Yea, I took out the space on some of them, so when the select distinct kicks in, it grabs them both.

(in reply to Spooky)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> Is it spaces in Sql that are blocking me?
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts