473,471 Members | 2,064 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Dataset alternative to stored proc row results

Al
Using the reader object I'm not having a problem retrieving stored
procedure return values, but I'm having trouble getting at the actual
data coming back in the row results. My first impulse would be to fill
a dataset, but I'd prefer to return the results in a more generic
fashion, hopefully via the reader. Again, these are row results coming
back from a proc, so there won't be any named variables to work with.
Any suggestions?

Thanks in advance,
Al

Nov 3 '05 #1
3 1339
Humm... Using GetOrdinal maybe ?

Else please elaborate a bit about what you meant by "I'm having trouble
getting at the actual data coming back in the row results"...

--
Patrice

"Al" <ti******@gmail.com> a écrit dans le message de
news:11**********************@g43g2000cwa.googlegr oups.com...
Using the reader object I'm not having a problem retrieving stored
procedure return values, but I'm having trouble getting at the actual
data coming back in the row results. My first impulse would be to fill
a dataset, but I'd prefer to return the results in a more generic
fashion, hopefully via the reader. Again, these are row results coming
back from a proc, so there won't be any named variables to work with.
Any suggestions?

Thanks in advance,
Al

Nov 3 '05 #2
Al
Thanks Patrice. Let's say this is the stored proc:

create procedure bogus
as
select last_name from people where first_name = "Al"
return 0

What I'm after is the row result, e.g., "Smith" as opposed to the
return value ("0" in this case). Here's what I'm doing:

SqlCommand myCommand =
GetConnection(sqlConnectionString,"bogus");
SqlDataReader myReader = myCommand.ExecuteReader();
while(myReader.Read())
{
stringResult = myReader.GetString(0);
}
myReader.Close();
---------------------------

In this case, "0" is returned instead of "Smith" - how do I get at
"Smith?"

Thanks,
Al

Nov 3 '05 #3
Al
WOOPS - my aplogies to anyone that applied any brain power to this
quandry - turns out my web service was pointing at a different server
than what I was running raw SQL against. So, a simple
myReader.GetSqlString(0).ToString() did the trick for me.

Thanks anyway,
Al

Nov 4 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Wolfgang Kreuzer | last post by:
Try hard to become familiar with T-SQL. Can anybodey tell me the best way to deal with set's provided by a stored procedure. Til yesterday I thougt trapping set in temp table using INSERT EXEC...
1
by: Jawahar Rajan | last post by:
Is it possible for a Dataset that is added to a C# project to be based on a stored Procedure? Can I use either a OracleClient or Microsoft Oracle Client? Any help is appreciated. Jawahar
1
by: Somebody_Out_There | last post by:
Hello, I am trying to create a strongly typed datatable/dataset from an untyped dataset or datatable returned from a stored proc. The structure of the table cannot be static since the results...
2
by: Sandy | last post by:
Hello - I have the following stored procedure and code. I want to put the results in two textboxes. I get to the part where I create the dataset and then I don't know what to do. I tried...
15
by: AussieRules | last post by:
Hi, I have a need to do two selects against to stored proc's in my SQL db. At the moment, each SP is called and two different dataset are populate. Thats two round trips to the SQL server. ...
3
by: Al | last post by:
Using the reader object I'm not having a problem retrieving stored procedure return values, but I'm having trouble getting at the actual data coming back in the row results. My first impulse would...
0
by: John | last post by:
Hi all, I'm calling a stored proc which does 4 "selects" and then I populate a dataset looping through the dr using a dr.NextResult() but the stored proc may not return any results for one or...
5
by: John | last post by:
Hi all, I'm sorry I'm reposting this but the original was urgent and I do need closure on this. I'm calling a stored proc which does 4 "selects" and then I populate a dataset looping through...
0
by: anonieko | last post by:
This approach I found very efficient and FAST when compared to the rowcount, or Subquery Approaches. This is before the advent of a ranking function from DB such as ROW_NUMBER() in SQL Server...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.