return a recordset from ado.net

  • Thread starter Thread starter Ivar
  • Start date Start date
I

Ivar

Hi,

Just use SqlDataAdapter, use SqlDataAdapter.Fill() to fill DataSet, return
DataSet instead of SQLDataReader.
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top