Order By Problems

Order By Problems

am 16.12.2004 21:41:06 von Jim in Arizona

I have a select field populated by a field within the table of an access
database. I can't seem to have the results alphabetized. Any helpful
insight, anyone?
The table is called jobtitles and the field is jobtitle.

<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
server.mappath("jobpostings.mdb")

Set RS = Server.CreateObject("ADODB.Recordset")
RS.Open ("SELECT jobtitles.jobtitle FROM jobtitles ORDER BY
jobtitles.jobtitle;"), Conn

Rs.MoveFirst

Response.Write("

")
Response.Write("

")
Response.Write("

")
%>


Thanks,
Jim

Re: Order By Problems

am 16.12.2004 21:43:35 von unknown

What happens instead? Are you saying that the job titles are not coming
back alphabetized? Can you post a list of the job titles in the order that
they're coming back?

Ray at work


"Jim in Arizona" wrote in message
news:ejSrm664EHA.1292@TK2MSFTNGP10.phx.gbl...
> I have a select field populated by a field within the table of an access
> database. I can't seem to have the results alphabetized. Any helpful
> insight, anyone?
> The table is called jobtitles and the field is jobtitle.
>
> <%
> Set Conn = Server.CreateObject("ADODB.Connection")
> Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
> server.mappath("jobpostings.mdb")
>
> Set RS = Server.CreateObject("ADODB.Recordset")
> RS.Open ("SELECT jobtitles.jobtitle FROM jobtitles ORDER BY
> jobtitles.jobtitle;"), Conn
>
> Rs.MoveFirst
>
> Response.Write("

")
> Response.Write("

")
> Response.Write("

")
> %>
>
>
> Thanks,
> Jim
>
>

Re: Order By Problems

am 16.12.2004 21:55:50 von gerard.leclercq

I can't see the problem. Maybe ; at end of Sql. This access, not ADO i
suppose.

And why are you using a Recordset Object?

<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
server.mappath("jobpostings.mdb")
Set Rs=Conn.Execute "SELECT jobtitles.jobtitle FROM jobtitles ORDER BY
jobtitles.jobtitle"

Response.Write("

")

Response.Write("

")
Response.Write("

")
> %>

Also Close and destroy object

Rs.Close
Set Rs=Nothing
Set Conn=Nothing

Re: Order By Problems

am 16.12.2004 22:04:29 von Jim in Arizona

Sorry Ray and all.

I was missaving my document! Ooops.

To my astonishment, when I saved over the proper document that I'm viewing
on my webserver, I get the proper results!

Thanks,
Jim





"Ray Costanzo [MVP]" wrote in
message news:eAafr$64EHA.2568@TK2MSFTNGP11.phx.gbl...
> What happens instead? Are you saying that the job titles are not coming
> back alphabetized? Can you post a list of the job titles in the order
> that
> they're coming back?
>
> Ray at work
>
>
> "Jim in Arizona" wrote in message
> news:ejSrm664EHA.1292@TK2MSFTNGP10.phx.gbl...
>> I have a select field populated by a field within the table of an access
>> database. I can't seem to have the results alphabetized. Any helpful
>> insight, anyone?
>> The table is called jobtitles and the field is jobtitle.
>>
>> <%
>> Set Conn = Server.CreateObject("ADODB.Connection")
>> Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
>> server.mappath("jobpostings.mdb")
>>
>> Set RS = Server.CreateObject("ADODB.Recordset")
>> RS.Open ("SELECT jobtitles.jobtitle FROM jobtitles ORDER BY
>> jobtitles.jobtitle;"), Conn
>>
>> Rs.MoveFirst
>>
>> Response.Write("

")
>> Response.Write("

")
>> Response.Write("

")
>> %>
>>
>>
>> Thanks,
>> Jim
>>
>>
>
>

Re: Order By Problems

am 16.12.2004 22:09:06 von Jim in Arizona

Thanks Gerard. My next question was going to be on how to properly destroy
the objects.

You asked me why I'm using a Recordset Object. The answer to that is pretty
simple: I'm still new to all this and don't know what I'm doing yet. :)
Makes me glad this NG exists!

Thanks,
Jim

"GĂ©rard Leclercq" wrote in message
news:qDmwd.2262$Fe4.103526@phobos.telenet-ops.be...
>I can't see the problem. Maybe ; at end of Sql. This access, not ADO i
>suppose.
>
> And why are you using a Recordset Object?
>
> <%
> Set Conn = Server.CreateObject("ADODB.Connection")
> Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
> server.mappath("jobpostings.mdb")
> Set Rs=Conn.Execute "SELECT jobtitles.jobtitle FROM jobtitles ORDER BY
> jobtitles.jobtitle"
>
> Response.Write("

")
>
> Response.Write("

")
> Response.Write("

")
>> %>
>
> Also Close and destroy object
>
> Rs.Close
> Set Rs=Nothing
> Set Conn=Nothing
>
>

Re: Order By Problems

am 17.12.2004 07:02:58 von gerard.leclercq

Welcome to the club. Why not recordset? Read more on www.aspFaq.com, see
http://www.aspfaq.com/2191