473,395 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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 1338
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.