Re: SQLs
From: lc (lc_at_hotmail.com)
Date: 07/30/04
- Next message: Kathy: "Re: Publish question"
- Previous message: Kevin Spencer: "Re: music"
- In reply to: Jim Buyens: "Re: SQLs"
- Next in thread: Jim Buyens: "Re: SQLs"
- Reply: Jim Buyens: "Re: SQLs"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 30 Jul 2004 07:12:42 -0700
Hi,
It doesnt create an error but the drop down is blank and
there is no value printed after the division =
Here is my new code:
<%@ Language=VBScript %>
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsGuestbook 'Holds the recordset for the records in
the database
Dim strSQL 'Holds the SQL query to query the
database
Dim strSQL4
'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using
a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)};
DBQ=" & Server.MapPath("alpha.mdb")
'Create an ADO recordset object
Set rsGuestbook = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to
query the database
strSQL = "SELECT DISTINCT tblEV3Location.Division FROM
tblEV3Location ORDER BY tblEV3Location.Division;"
'Open the recordset with the SQL query
rsGuestbook.Open strSQL, adoCon
set cars=adoCon.execute(strSQL)
%>
<select name="Division">
<% 'Loop through the recordset to make each entry
in the list. %>
<% do while not cars.eof %>
<Option value = "<%= cars(0) %>"><%= cars
(0) %></Option>
<%cars.movenext
loop%>
</select>
<%
strSQL4 = "SELECT DISTINCT tblEV3Location.Code,
tblEV3Location.Division FROM tblEV3Location WHERE
tblEV3Location.Division='" & Request("Division") &"';"
%>
<%set cars4=adoCon.execute(strSQL4)
%>
<select name="Code">
<% 'Loop through the recordset to make each entry
in the list. %>
<% do while not cars4.eof %>
<Option value = "<%= cars4(0) %>"><%=
cars4(0) %></Option>
<%cars4.movenext
loop%>
</select>
<html>
<head>
<title> select </title>
</head>
<body><%="Division=" & request("Division")%>
</body>
</html>
Thank you.
>-----Original Message-----
>Howdy.
>
>Please define "doesn't work". How does it fail?
>
>Also, does putting <%="code=" & request("code")%>
immediately
>after the <body> tag display the code value you expect?
>
>Jim Buyens
>Microsoft FrontPage MVP
>http://www.interlacken.com
>Author of:
>*----------------------------------------------------
>|\---------------------------------------------------
>|| Microsoft Office FrontPage 2003 Inside Out
>||---------------------------------------------------
>|| Web Database Development Step by Step .NET Edition
>|| Microsoft FrontPage Version 2002 Inside Out
>|| Faster Smarter Beginning Programming
>|| (All from Microsoft Press)
>|/---------------------------------------------------
>*----------------------------------------------------
>
>
>"LC" <lc@hotmail.com> wrote in message
news:<6c8001c4759b$c97698f0$a501280a@phx.gbl>...
>> Hi,
>>
>> For some odd reason that code doesnt work.
>> Is there something missing at the WHERE
>> tblEV3Location.Division= ?
>>
>> Thanks.
>> >-----Original Message-----
>> >Howdy.
>> >
>> >strSQL4 = "SELECT DISTINCT tblEV3Location.Division "
& _
>> > "FROM tblEV3Location " & _
>> > "WHERE tblEV3Location.Division='" & _
>> > request("code") & "';"
>> >
>> >Jim Buyens
>> >Microsoft FrontPage MVP
>> >http://www.interlacken.com
>> >Author of:
>> >*----------------------------------------------------
>> >|\---------------------------------------------------
>> >|| Microsoft Office FrontPage 2003 Inside Out
>> >||---------------------------------------------------
>> >|| Web Database Development Step by Step .NET Edition
>> >|| Microsoft FrontPage Version 2002 Inside Out
>> >|| Faster Smarter Beginning Programming
>> >|| (All from Microsoft Press)
>> >|/---------------------------------------------------
>> >*----------------------------------------------------
>> >
>> >
>> >>-----Original Message-----
>> >>Hi,
>> >>
>> >>I have two or more sql statements that depends on
the
>> >>other on the same page. For example I have strSQL3
and
>> >>then strSQL4 will need the result from the dropdown
of
>> >>strSQL3 to start its sql.
>> >>
>> >>strSQL3 = "SELECT DISTINCT tblEV3Location.Code FROM
>> >>tblEV3Location ORDER BY tblEV3Location.Code;"
>> >>
>> >><% set cars3=adoCon.execute(strSQL3) %>
>> >><select name="Code">
>> >> <% 'Loop through the recordset to make each entry
>> >>in the list. %>
>> >> <% do while not cars3.eof %>
>> >> <Option value = "<%= cars3(0) %>"> <%=
>> >>cars3(0) %></Option>
>> >> <%cars3.movenext
>> >> loop%>
>> >></select>
>> >>
>> >>How would I do something like this where the Code is
>> the
>> >>name of the drop-down?:
>> >>strSQL4 = "SELECT DISTINCT tblEV3Location.Division
FROM
>> >>tblEV3Location WHERE
tblEV3Location.Division='Code';"
>> >>
>> >>Thanks.
>> >>
>> >>.
>> >>
>> >.
>> >
>.
>
- Next message: Kathy: "Re: Publish question"
- Previous message: Kevin Spencer: "Re: music"
- In reply to: Jim Buyens: "Re: SQLs"
- Next in thread: Jim Buyens: "Re: SQLs"
- Reply: Jim Buyens: "Re: SQLs"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|