Problem with stored procedure OLEDB/ODBC 
Author Message
 Problem with stored procedure OLEDB/ODBC

Hi!

I have a storedprocedure which creates a temporary table, puts some data in
it, and then returns de resultset of the temporary table.

When I want to put the resultset in a ADODB.recordset object ( set rst =
cnn.execute("MuStoresProcedure 1"), where 1 is an input parameter, I get the
resultset when I'm connected to my Sql Server using an ODBC-connection.

When connected by an OLEDB-connection, the recordset object is not filled.
It keeps closed. I do not get any error or something.

Anyone knows what's going on?

Regards



Mon, 28 Mar 2005 22:09:40 GMT  
 Problem with stored procedure OLEDB/ODBC

Are you using SET NOCOUNT ON/OFF in your stored procedure?
Could you post some DDL?

AMB

  Hi!

  I have a storedprocedure which creates a temporary table, puts some data in
  it, and then returns de resultset of the temporary table.

  When I want to put the resultset in a ADODB.recordset object ( set rst =
  cnn.execute("MuStoresProcedure 1"), where 1 is an input parameter, I get the
  resultset when I'm connected to my Sql Server using an ODBC-connection.

  When connected by an OLEDB-connection, the recordset object is not filled.
  It keeps closed. I do not get any error or something.

  Anyone knows what's going on?

  Regards



Mon, 28 Mar 2005 22:11:55 GMT  
 Problem with stored procedure OLEDB/ODBC
Here is the storedprocedure:

----------------------------------

AS

/* Create the temp table */

CREATE TABLE #tblThuisWerkers (Tw_ID INT Identity Primary Key, TwDatum
datetime, TwMutNr int,TwOmschrijving nvarchar(50), TwAltered int,TwType
nvarchar(50))

/* Insert data */
INSERT INTO #tblThuisWerkers SELECT MutAddDatum, MutNr, MutSoort, (SELECT
count(*) FROM tblLogMutaties WHERE tblLogMutaties.Mut_ID=tblMutaties.Mut_ID


INSERT INTO #tblThuisWerkers SELECT MutChangeDate, MutNr, MutSoort,

INSERT INTO #tblThuisWerkers SELECT SeBeginDatum, 0, 'Login',null,'Login'

INSERT INTO #tblThuisWerkers SELECT SeEindDatum,  0,'Loguit',null,'Loguit'

/* Getting resultset */
SELECT * FROM #tblThuisWerkers ORDER BY TwDatum

-----------------------------------


Are you using SET NOCOUNT ON/OFF in your stored procedure?
Could you post some DDL?

AMB

Hi!

I have a storedprocedure which creates a temporary table, puts some data in
it, and then returns de resultset of the temporary table.

When I want to put the resultset in a ADODB.recordset object ( set rst =
cnn.execute("MuStoresProcedure 1"), where 1 is an input parameter, I get the
resultset when I'm connected to my Sql Server using an ODBC-connection.

When connected by an OLEDB-connection, the recordset object is not filled.
It keeps closed. I do not get any error or something.

Anyone knows what's going on?

Regards



Mon, 28 Mar 2005 22:21:43 GMT  
 Problem with stored procedure OLEDB/ODBC


Wed, 18 Jun 1902 08:00:00 GMT  
 Problem with stored procedure OLEDB/ODBC
Update:
When trying to retrieve the resultset of a normally existing table (no
temporary table) it all work's ok.


Quote:
> Hi!

> I have a storedprocedure which creates a temporary table, puts some data
in
> it, and then returns de resultset of the temporary table.

> When I want to put the resultset in a ADODB.recordset object ( set rst =
> cnn.execute("MuStoresProcedure 1"), where 1 is an input parameter, I get
the
> resultset when I'm connected to my Sql Server using an ODBC-connection.

> When connected by an OLEDB-connection, the recordset object is not filled.
> It keeps closed. I do not get any error or something.

> Anyone knows what's going on?

> Regards



Mon, 28 Mar 2005 22:26:35 GMT  
 Problem with stored procedure OLEDB/ODBC

Put SET NOCOUNT ON at the begining of your sp.

AMB

  Update:
  When trying to retrieve the resultset of a normally existing table (no
  temporary table) it all work's ok.



  > Hi!
  >
  > I have a storedprocedure which creates a temporary table, puts some data
  in
  > it, and then returns de resultset of the temporary table.
  >
  > When I want to put the resultset in a ADODB.recordset object ( set rst =
  > cnn.execute("MuStoresProcedure 1"), where 1 is an input parameter, I get
  the
  > resultset when I'm connected to my Sql Server using an ODBC-connection.
  >
  > When connected by an OLEDB-connection, the recordset object is not filled.
  > It keeps closed. I do not get any error or something.
  >
  > Anyone knows what's going on?
  >
  > Regards
  >
  >
  >



Mon, 28 Mar 2005 22:48:05 GMT  
 Problem with stored procedure OLEDB/ODBC

Thanx! it works.

Can you tell me why this works?

  Put SET NOCOUNT ON at the begining of your sp.

  AMB

    Update:
    When trying to retrieve the resultset of a normally existing table (no
    temporary table) it all work's ok.



    > Hi!
    >
    > I have a storedprocedure which creates a temporary table, puts some data
    in
    > it, and then returns de resultset of the temporary table.
    >
    > When I want to put the resultset in a ADODB.recordset object ( set rst =
    > cnn.execute("MuStoresProcedure 1"), where 1 is an input parameter, I get
    the
    > resultset when I'm connected to my Sql Server using an ODBC-connection.
    >
    > When connected by an OLEDB-connection, the recordset object is not filled.
    > It keeps closed. I do not get any error or something.
    >
    > Anyone knows what's going on?
    >
    > Regards
    >
    >
    >



Mon, 28 Mar 2005 23:05:55 GMT  
 Problem with stored procedure OLEDB/ODBC

When you do not set SET NOCOUNT ON, sql server message (? row(s) affected) is send to the client as a recordset, then you need to use:

set objRs = objRs.NextRecordset

because your data is in the second recordset.

AMB



Mon, 28 Mar 2005 23:13:48 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Problem with stored procedure OLEDB/ODBC

2. Problem with stored procedure OLEDB/ODBC

3. Problem with stored procedure OLEDB/ODBC

4. Problems with ODBC and Stored Procedures

5. Last try for stored procedures/ODBC problem...

6. VB 5.0, RDO, ODBC, Oracle stored procedure problem...

7. Stored Procedure problem via ODBC from VB

8. ADO OLEDB 2.7 with Oracle Stored Procedure

9. Oracle Stored Procedures OLEDB and ADO

10. To Stored Procedure or not to stored procedure

11. To stored procedure or not to stored procedure

12. sub report changes its source stored procedure to main report's stored procedure

 

 
Powered by phpBB® Forum Software