|
 |
access_asp thread: How to read records from a stored procedure?
Message #1 by "Blossom" <bmathew1@s...> on Mon, 8 Apr 2002 05:07:16
|
|
Hi ?
I am having trouble retrieving recods from an access stored procedure.
It seems the cursor is either at the beginning or end of the file. I do
not understand what is wrong.
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "cc_db"
Set objRS2 = objConn.Execute ("exec qHtmlEmailList")
objRS2.MoveFirst()
WHile not objRS2.EOF
Response.WRite objRS2("email")
Response.Write "<BR>"
objRS2.MoveNext()
Wend
If I remove objRS2.MoveFirst(), I receive a blank screen with no data. I
copied this query in Access into a main table and I can read through the
records fine. However, I cant figure out why I cant read the values
from this stored procedure. Am I doing something wrong or is this a
problem with ADO?
Thanks,
Blossom
Message #2 by "Rob Parkhouse" <rparkhouse@o...> on Mon, 8 Apr 2002 06:05:04
|
|
I repeated your code (with changes to reflect my database) and all seemed
to work OK. The only difference is the objConn.Open statement. Mine was of
the form
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=rob;" & _
"Data Source=C:\SurvMgr_ST\Surv360_ORA.mdb;" & _
"Persist Security Info=False;Jet OLEDB:System " _
"database=c:\survmgr_st\cmsadm.mdw"
You don't need all the stuff on my connection string, but does "cc_db"
fully describe the database and it's location??
Regards
> Hi ?
> I am having trouble retrieving recods from an access stored procedure.
I> t seems the cursor is either at the beginning or end of the file. I do
n> ot understand what is wrong.
> Set objConn = Server.CreateObject("ADODB.Connection")
o> bjConn.Open "cc_db"
> Set objRS2 = objConn.Execute ("exec qHtmlEmailList")
> objRS2.MoveFirst()
> WHile not objRS2.EOF
> Response.WRite objRS2("email")
> Response.Write "<BR>"
> objRS2.MoveNext()
W> end
> If I remove objRS2.MoveFirst(), I receive a blank screen with no data.
I
c> opied this query in Access into a main table and I can read through the
r> ecords fine. However, I cant figure out why I cant read the values
f> rom this stored procedure. Am I doing something wrong or is this a
p> roblem with ADO?
> Thanks,
> Blossom
Message #3 by "Blossom" <bmathew1@s...> on Mon, 8 Apr 2002 22:50:06
|
|
91%
Unauthorized use is prohibited.
Hi-
I am still having trouble displaying the results from the Access stored
procedure. When I run the code below, I receive a blank screen. However,
if I run the script against a main table (and not a stored procedure) I
receive the output. Is there a special way in accessing data from a
stored procedure in MS Access?
Set objRS2 = Server.CreateObject("ADODB.RecordSet")
objRS2.Open "qHtmlEmailList", objConn, adOpenStatic, AdLockReadOnly
WHile not objRS2.EOF
Response.WRite objRS2("email")
Response.Write "<BR>"
objRS2.MoveNext()
Wend
Thanks,
Blossom
Message #4 by "Blossom" <bmathew1@s...> on Tue, 9 Apr 2002 02:41:14
|
|
Hi -
I figured out why I kept receiving no records when trying to return the
results of my Access query - I was using the "like" operator in my
query. I wrote a new query without the "like" operator and then tried
viewing the query from an ASP page - it worked. Does anyone know why
this is?
Message #5 by "Ken Schaefer" <ken@a...> on Tue, 9 Apr 2002 11:50:12 +1000
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Blossom" <bmathew1@s...>
Subject: [access_asp] Re: How to read records from a stored procedure?
: I figured out why I kept receiving no records when trying to return the
: results of my Access query - I was using the "like" operator in my
: query. I wrote a new query without the "like" operator and then tried
: viewing the query from an ASP page - it worked. Does anyone know why
: this is?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please show us what you were actually doing, then we might be able to help.
Eg
Response.Write(strSQL)
Response.End
and show us what you were actually sending to the database.
Cheers
Ken
|
|
 |