Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 ODBC Programmig STORED PROCEDURES Retrieving Rows

Author  Topic 

gregor_mt
Starting Member

3 Posts

Posted - 2008-12-19 : 05:59:42
Hi everybody,

I would like to ask for hints in processing user defined stored procedures.

For testing, I have created following procedure:



CREATE PROCEDURE dbo.test_proc1

@Count
int,

@RetParam varchar(30) OUT

AS

BEGIN

DECLARE @i int

DECLARE @tmpTable TABLE (ID int, aTextField varchar(40) )


SET @i = 0

WHILE @i < @COUNT

BEGIN

SET @i = @i + 1

INSERT INTO @tmpTable

VALUES (@i, cast(newid() as char(36)))

END

SET @RetParam = 'just for testing'

SELECT * FROM @tmpTable

END


GO


What must be done in application that uses ODBC API to execute and retrieve data (column names and types as well)? There is no problem with obtaining metadata information about procedure parameters, but what about fields returned by the SELECT statement ? And then how process records from the result rowset ? Calling SQLNumResultCols and SQLDescribeCol or SQLProcedureColumns brings nothing.

I'll be thankful for any hints.

Regards
Gregor

darkdusky
Aged Yak Warrior

591 Posts

Posted - 2008-12-23 : 04:33:51
It depends on which programming language your application is written in.
You can read the Select statement in VB.Net using SqlHelper.ExecuteScalar / SqlHelper.ExecuteDataset etc.
Go to Top of Page
   

- Advertisement -