how to get the records from a stored procedure in Mysql

how to get the records from a stored procedure in Mysql

am 03.02.2006 16:59:12 von Kevin

Hi,

I use ASP together with Mysql.
I made a stored procedure ('proctest') in Mysql.
In ASP, i did:
<%
set OBJDC = Server.CreateObject("ADODB.Connection")
objdc.Open "Driver={MySQL ODBC 3.51 Driver}; Server=localhost; Port=3306;
Option=0; Socket=; Stmt=; Database=db; Uid=root; Pwd=xxx;"
set rs=CreateObject("adodb.recordset")
call proctest rs
rsarray = rs.getrows()
response.write(rsarray(0,0))
%>

But i get an error. I must be close, but can't find it. I think that 'call'
is part of Mysql-syntax but not of ASP, so how to combine both?
Thanks
Kevin

Re: how to get the records from a stored procedure in Mysql

am 03.02.2006 17:57:35 von unknown

It's usually good to tell us what the error is and point out the line that
it's happening on.

Try this:


set OBJDC = Server.CreateObject("ADODB.Connection")
objdc.Open "Driver={MySQL ODBC 3.51 Driver}; Server=localhost;
Port=3306;Option=0; Socket=; Stmt=; Database=db; Uid=root; Pwd=xxx;"
''NOT NECESSARY: set rs=CreateObject("adodb.recordset")
Set rs = objdc.Execute("execute proctest") ''not sure if MySql uses
"execute"
If Not rs.EOF Then
rsarray = rs.getrows()
response.write rsarray(0,0)
Else
Response.Write "No records"
End If

Ray at work


"Kevin" wrote in message
news:%23NnLhrNKGHA.1132@TK2MSFTNGP10.phx.gbl...
> Hi,
>
> I use ASP together with Mysql.
> I made a stored procedure ('proctest') in Mysql.
> In ASP, i did:
> <%
> set OBJDC = Server.CreateObject("ADODB.Connection")
> objdc.Open "Driver={MySQL ODBC 3.51 Driver}; Server=localhost; Port=3306;
> Option=0; Socket=; Stmt=; Database=db; Uid=root; Pwd=xxx;"
> set rs=CreateObject("adodb.recordset")
> call proctest rs
> rsarray = rs.getrows()
> response.write(rsarray(0,0))
> %>
>
> But i get an error. I must be close, but can't find it. I think that
> 'call'
> is part of Mysql-syntax but not of ASP, so how to combine both?
> Thanks
> Kevin
>
>

Re: how to get the records from a stored procedure in Mysql

am 03.02.2006 18:20:17 von Kevin

Thanks,
Set rs = objdc.Execute("execute proctest") must be:
Set rs = objdc.Execute("call proctest") and it works ...


"Ray Costanzo [MVP]" wrote in
message news:esBbvLOKGHA.720@TK2MSFTNGP14.phx.gbl...
> It's usually good to tell us what the error is and point out the line that
> it's happening on.
>
> Try this:
>
>
> set OBJDC = Server.CreateObject("ADODB.Connection")
> objdc.Open "Driver={MySQL ODBC 3.51 Driver}; Server=localhost;
> Port=3306;Option=0; Socket=; Stmt=; Database=db; Uid=root; Pwd=xxx;"
> ''NOT NECESSARY: set rs=CreateObject("adodb.recordset")
> Set rs = objdc.Execute("execute proctest") ''not sure if MySql uses
> "execute"
> If Not rs.EOF Then
> rsarray = rs.getrows()
> response.write rsarray(0,0)
> Else
> Response.Write "No records"
> End If
>
> Ray at work
>
>
> "Kevin" wrote in message
> news:%23NnLhrNKGHA.1132@TK2MSFTNGP10.phx.gbl...
> > Hi,
> >
> > I use ASP together with Mysql.
> > I made a stored procedure ('proctest') in Mysql.
> > In ASP, i did:
> > <%
> > set OBJDC = Server.CreateObject("ADODB.Connection")
> > objdc.Open "Driver={MySQL ODBC 3.51 Driver}; Server=localhost;
Port=3306;
> > Option=0; Socket=; Stmt=; Database=db; Uid=root; Pwd=xxx;"
> > set rs=CreateObject("adodb.recordset")
> > call proctest rs
> > rsarray = rs.getrows()
> > response.write(rsarray(0,0))
> > %>
> >
> > But i get an error. I must be close, but can't find it. I think that
> > 'call'
> > is part of Mysql-syntax but not of ASP, so how to combine both?
> > Thanks
> > Kevin
> >
> >
>
>