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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 About SQL Server and ADO

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-06-19 : 11:12:47
Manish Patil writes "Dear sir,
I am software developer, from a small town in India.
I use SQL Server 2000.
And I love working with it. It works fine.

My problem is related with Visual Basic and ADO specially when used with SQL Server.
SQL Server wont be of any use if it is not compatible with Visual Basic and ADO.

I have a stored procedure with a Temporary table in the stored procedure, with some parameters.
I basically insert some data in the temp table and then retrieve the data, to be shown in a report using crystal report, it works fine.

But when I try to retrieve that data using ADO Command object with in VB, it gives nothing, it gives an error.

Why.

I desperately need some help on this sir

Please mail me @
Golden_manish@rediffmail.com"

simondeutsch
Aged Yak Warrior

547 Posts

Posted - 2003-06-19 : 12:00:38
Do you have a SET NOCOUNT ON at the top of the procedure? If not ,add it in, and add a SET NOCOUNT OFF at the bottom, before RETURN.

Sarah Berger MCSD
Go to Top of Page

golden_manish
Starting Member

13 Posts

Posted - 2003-06-26 : 11:28:48
Thanks Sir.
It worked wonderfully well.
But i still got a query, if the SP isn't returning how many rows wore affected. Why does it matter, Why does it matter to ADO, and gives me the result.

Manish Here
Signing off

Go to Top of Page

mohdowais
Sheikh of Yak Knowledge

1456 Posts

Posted - 2003-06-26 : 16:33:42
quote:
Thanks Sir.

Er...manish, that should be Thanks Madam

quote:
But i still got a query, if the SP isn't returning how many rows wore affected. Why does it matter, Why does it matter to ADO, and gives me the result.


It does matter. You see, for ADO any data returned by SQL Server in a batch is a result-set. Hence your stored procedure might return two batches:

Result-set 1: (from your insert)
(20 rows affected)

Result-set 2:
Col1 Col2 Col3
=================
blah blah blah
blaa blaa blaa
(2 rows returned)

You see, if you dont include SET NOCOUNT ON at the top, it returns two recordsets, the first one empty, and the second one with the data. By default the first one is active and it has no data in it, so you get an EOF error. You can also use RS.NextRecordset to get the next resultset (if you dont have SET NOCOUNT ON)

Owais

Go to Top of Page
   

- Advertisement -