Hi,
Here you are 1st populating the data from the database and checking whether that value matches with your textbox valus in the
if statement. Instead of doing that you canoptimize your query like this:
string t = "select * from Product where Product1 = " + TextBox1.Text;
SqlDataAdapter fd = new SqlDataAdapter(t, DbConnection.mCon);
DataSet ds = new DataSet();
fd.Fill(ds);
if(ds.Tables[0].Rows.Count > 0)
{
}
else
{
}
This will reduce the time taken for your data retrieval.
Thanks