By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,416 Members | 1,470 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,416 IT Pros & Developers. It's quick & easy.

Retrieve result from SqlCommand

P: n/a
Dear developer,

I'm developing a web service with VS .NET and using C#. And part of the
webservice is to get data from database (by using SELECT), however, the
result from the sql query i cannot parse it to string, how can i get the
result from the SqlCommand..? dataset or datareader..?.

pls advice & thanks a lot.
cheers,
Wong CS
Nov 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

"Wong CS" <ch***********@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I'm developing a web service with VS .NET and using C#. And part of the
webservice is to get data from database (by using SELECT), however, the
result from the sql query i cannot parse it to string, how can i get the
result from the SqlCommand..? dataset or datareader..?.


Why do you want to parse it into a string? That's almost always the wrong
answer to every question. You can either return the dataset directly from
the web method, or use a datareader to fill a collection of objects that
represent your results.

As to DataSet or SqlDataReader -- what are you using with your SqlCommand?
If you're using it with an adapter, you'll be filling a DataSet instance. If
you're calling ExecuteReader directly, then you're going to be dealing with
an instance of SqlDataReader.

--
Mickey Williams
Author, "Visual C# .NET Core Ref", MS Press
www.neudesic.com
www.servergeek.com

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.