I have an application (ASP.Net using C# ) . I need to read records from the
database based on the value entered by the user. Using Data Reader , I can
see only one record in text boxes. But how do i view the next record in the
text boxes?? I found out that using DataReader.NextRecord() , it is
possible. Is the following code correct?
My code ::
System.Data.SqlClient.SqlDataReader d1;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}
private void Button1_Click(object sender, System.EventArgs e)
{
sqlCommand1.Parameters["@a"].Value=txtC.Text;
sqlConnection1.Open();
d1= sqlCommand1.ExecuteReader();
do
{
while(d1.Read())
{
TextBox3.Text= d1["Company"].ToString();
TextBox4.Text=d1["Ceo"].ToString();
TextBox5.Text=d1["Month"].ToString();
}
}while(d1.NextResult());
d1.Close();
sqlConnection1.Close();
}
--
pmud