2
Reply

Invalid attempt to read when no data is present in ASP.NET

selva kumar

selva kumar

Feb 4 2015 2:42 AM
788
I am using C# to learn ASP.NET, I tried to write authentication code as
but i am always got these error plz give some solution.. 
 
protected void Button3_Click(object sender, EventArgs e)
{
Button3.Visible = true;
txtdms.Visible = true;
lbldms.Visible = true;
str3 = "Select [Coloum Name1],[Coloum Name2] from LPsupplier where [DMS Vendor Code] = '" + txtbox.Text + "'";
sqlCmd.Connection = conn;
sqlCmd.Connection.Open();
sqlCmd.CommandText = str3;
sqlDr = sqlCmd.ExecuteReader();
sqlDr.Read();
txtaxcode.Text = sqlDr["Coloum Name1"].ToString();
txtvendorname.Text = sqlDr["Coloum Name2"].ToString();
}

Answers (2)