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

return a recordset from ado.net

P: n/a
hi
i am trying to return a recordset from my web service to my c# app.
[WebMethod]
public SQLDataReader getAllCities()
{
string sqlQuery = "select CityName from city";
SqlCommand comm = new SqlCommand(sqlQuery,conn);
SqlDataReader reader = comm.ExecuteReader();
while(reader.Read())
{
Console.WriteLine(reader[0]);
}
return reader;
}
but i dont know how to return it.

also how can i view the results , when i invoke the webservice?

thanx

Zarish.

Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

Hi,

Just use SqlDataAdapter, use SqlDataAdapter.Fill() to fill DataSet, return
DataSet instead of SQLDataReader.

"zarish" <sh******@hotmail.com> wrote in message
news:us*************@tk2msftngp13.phx.gbl...
hi
i am trying to return a recordset from my web service to my c# app.
[WebMethod]
public SQLDataReader getAllCities()
{
string sqlQuery = "select CityName from city";
SqlCommand comm = new SqlCommand(sqlQuery,conn);
SqlDataReader reader = comm.ExecuteReader();
while(reader.Read())
{
Console.WriteLine(reader[0]);
}
return reader;
}
but i dont know how to return it.

also how can i view the results , when i invoke the webservice?

thanx

Zarish.

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.