Home » questions » two problems in ASP.NET 2.0?

two problems in ASP.NET 2.0?

2006-07-31 09:47:31, Category: Programming & Design
How I can know my sqldatasourse found any record or not I dont want to use datalist or another data table .and how I can put each feild that sqldatasource found on a string object( ineed just one record that sqldatasource found.) I need a code that on page load automaticly goto another page

Answers

  1. Railgun

    On 2006-07-31 11:08:12


    The DataTable has a property called Rows, which has a property called Count. Obvoiusly, if Count == 0, then no rows were return. Simple as that.
  2. wisam z

    On 2006-07-31 10:33:39


    first you have to make a datareader (let's call it rd1 for example), and fill it with proper data from the datasource. now you use while ( rd1.read()) { // do what ever and then go the next record in rd1 } the secret is that the method rd1.read() will check if there are any records retrieved, and if yes it will return them