Ask a Question related to ASP Database, Design and Development.
-
DavidT #1
getrows breaks if WHERE in sql
Hello all willing to assist. This should be simple but it's killing me. I
have this query (Access2k):
strsql="SELECT M.NewRingNum "
strsql= strsql & "FROM tblMain M "
strsql= strsql & "WHERE M.NewRingNum LIKE 'PH*' "
strsql= strsql & "ORDER BY M.NewRingNum;"
If run in access it returns a column of information begining with PH like
you would assume. If I insert it into an ASP page and try to set it to
getrows I get an error. Specifically:
Error Type:
ADODB.Recordset (0x800A0BCD)
Either BOF or EOF is True, or the current record has been deleted. Requested
operation requires a current record.
I'm doing it like this:
strConn="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" &
server.mappath("RingTracker_Web.mdb") & ";"
set rsTMP=server.createobject("adodb.recordset")
rsTMP.open strsql, strconn
alldata=rstmp.getrows '<< Error happens here
rstmp.close
set rstmp=nothing
set strconn=nothing
If I comment out the WHERE part, it works. ANY thoughts are appreciated. I'm
stumped.
TIA
David
DavidT Guest
-
Paging and getrows
Assuming the code below, whats the most efficient way to get the actual record count as the full array count doesnt exist :-) I want to keep the... -
Getrows = funny result
Hi, I want to use Getrows on a recordset. using 3 recordsets: set rs2003 = Server.CreateObject("ADODB.recordset") set rs2002 =... -
GetRows and ASP 2.0
Hello, Are there a lot of differences between ASP 2.0 and 3.0. My development environment is a bit more up to date then my production system. I... -
GetRows Mystery
I'm facing an odd behavior in using the GetRows Method. I'm not sure what's causing it because it has been working fine until now. I have a sproc... -
Using GetRows()
I am getting information out of a table to place into to an Array. rs=DataConn.Execute(strSQL) At this point I place it into the array ... -
Ray at #2
Re: getrows breaks if WHERE in sql
Your problem isn't with the fact that you're using WHERE. It's that when
you're using WHERE, you're getting no records back, and you're trying to
GetRows on an empty recordset. That means that there are no records that
are like 'PH*'. With ADO, use % instead of * for your wildcard (even with
Access).
Always check for EOF!
If Not rstemp.EOF Then alldata = rstemp.GetRows()
rsTemp.Close : Set rsTemp = Nothing
'''close and destroy connection
If Not IsEmpty(alldata) Then
'''do stuff
Else
Response.Write "0 records"
End If
Ray at work
"DavidT" <david.timm@t-mobile.com> wrote in message
news:ewSkYjMIEHA.2744@TK2MSFTNGP10.phx.gbl...Requested> Hello all willing to assist. This should be simple but it's killing me. I
> have this query (Access2k):
>
> strsql="SELECT M.NewRingNum "
>
> strsql= strsql & "FROM tblMain M "
>
> strsql= strsql & "WHERE M.NewRingNum LIKE 'PH*' "
>
> strsql= strsql & "ORDER BY M.NewRingNum;"
>
> If run in access it returns a column of information begining with PH like
> you would assume. If I insert it into an ASP page and try to set it to
> getrows I get an error. Specifically:
>
> Error Type:
> ADODB.Recordset (0x800A0BCD)
> Either BOF or EOF is True, or the current record has been deleted.> operation requires a current record.
>
>
> I'm doing it like this:
>
> strConn="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" &
> server.mappath("RingTracker_Web.mdb") & ";"
>
>
> set rsTMP=server.createobject("adodb.recordset")
>
> rsTMP.open strsql, strconn
>
>
> alldata=rstmp.getrows '<< Error happens here
Ray at Guest
-
DavidT #3
Re: getrows breaks if WHERE in sql
Ray...Ya da MAN! It was the % that was killing y RS. That's why I would get
data by running the query in Access. I didn't know that was an ADO thing. I
thought it was SQL Server vs Access thing. I made the switch and it works!
Normally I'd check for EOF but there will ALWAYS be values for this RS.
Always. 100% of the time.
Thanks again. You made my Monday.
David - also at work.
"Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
message news:exL25vMIEHA.700@TK2MSFTNGP09.phx.gbl...I> Your problem isn't with the fact that you're using WHERE. It's that when
> you're using WHERE, you're getting no records back, and you're trying to
> GetRows on an empty recordset. That means that there are no records that
> are like 'PH*'. With ADO, use % instead of * for your wildcard (even with
> Access).
>
> Always check for EOF!
>
> If Not rstemp.EOF Then alldata = rstemp.GetRows()
> rsTemp.Close : Set rsTemp = Nothing
> '''close and destroy connection
>
> If Not IsEmpty(alldata) Then
> '''do stuff
> Else
> Response.Write "0 records"
> End If
>
> Ray at work
>
>
> "DavidT" <david.timm@t-mobile.com> wrote in message
> news:ewSkYjMIEHA.2744@TK2MSFTNGP10.phx.gbl...> > Hello all willing to assist. This should be simple but it's killing me.like> > have this query (Access2k):
> >
> > strsql="SELECT M.NewRingNum "
> >
> > strsql= strsql & "FROM tblMain M "
> >
> > strsql= strsql & "WHERE M.NewRingNum LIKE 'PH*' "
> >
> > strsql= strsql & "ORDER BY M.NewRingNum;"
> >
> > If run in access it returns a column of information begining with PH> Requested> > you would assume. If I insert it into an ASP page and try to set it to
> > getrows I get an error. Specifically:
> >
> > Error Type:
> > ADODB.Recordset (0x800A0BCD)
> > Either BOF or EOF is True, or the current record has been deleted.>> > operation requires a current record.
> >
> >
> > I'm doing it like this:
> >
> > strConn="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" &
> > server.mappath("RingTracker_Web.mdb") & ";"
> >
> >
> > set rsTMP=server.createobject("adodb.recordset")
> >
> > rsTMP.open strsql, strconn
> >
> >
> > alldata=rstmp.getrows '<< Error happens here
>
DavidT Guest
-
Ray at #4
Re: getrows breaks if WHERE in sql
Cool. Glad it worked.
IMO, there is no such thing as ALWAYS, but that's just me. :]
Rya at work
"DavidT" <david.timm@t-mobile.com> wrote in message
news:O4Z1d4MIEHA.2576@TK2MSFTNGP09.phx.gbl...get> Ray...Ya da MAN! It was the % that was killing y RS. That's why I wouldI> data by running the query in Access. I didn't know that was an ADO thing.when> thought it was SQL Server vs Access thing. I made the switch and it works!
>
> Normally I'd check for EOF but there will ALWAYS be values for this RS.
> Always. 100% of the time.
>
> Thanks again. You made my Monday.
> David - also at work.
>
> "Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
> message news:exL25vMIEHA.700@TK2MSFTNGP09.phx.gbl...> > Your problem isn't with the fact that you're using WHERE. It's thatthat> > you're using WHERE, you're getting no records back, and you're trying to
> > GetRows on an empty recordset. That means that there are no recordswith> > are like 'PH*'. With ADO, use % instead of * for your wildcard (even> > Access).
> >
> > Always check for EOF!
Ray at Guest
-
DavidT #5
Re: getrows breaks if WHERE in sql
Funny thing was...not 10 seconds after sending that I said "I wonder...."
and proved myself wrong. =)
I then added code to comepnsate for EOF and humbly change my reply to ALMOST
always.
Thanks again.
"Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
message news:#GBa58MIEHA.3720@tk2msftngp13.phx.gbl...thing.> Cool. Glad it worked.
>
> IMO, there is no such thing as ALWAYS, but that's just me. :]
>
> Rya at work
>
> "DavidT" <david.timm@t-mobile.com> wrote in message
> news:O4Z1d4MIEHA.2576@TK2MSFTNGP09.phx.gbl...> get> > Ray...Ya da MAN! It was the % that was killing y RS. That's why I would> > data by running the query in Access. I didn't know that was an ADOworks!> I> > thought it was SQL Server vs Access thing. I made the switch and itto> when> >
> > Normally I'd check for EOF but there will ALWAYS be values for this RS.
> > Always. 100% of the time.
> >
> > Thanks again. You made my Monday.
> > David - also at work.
> >
> > "Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
> > message news:exL25vMIEHA.700@TK2MSFTNGP09.phx.gbl...> > > Your problem isn't with the fact that you're using WHERE. It's that> > > you're using WHERE, you're getting no records back, and you're trying> that> > > GetRows on an empty recordset. That means that there are no records> with> > > are like 'PH*'. With ADO, use % instead of * for your wildcard (even>> > > Access).
> > >
> > > Always check for EOF!
>
DavidT Guest



Reply With Quote

