Hi,
It's good practice to check if your data calls actually return data before trying to use any of it.
In your instance, checking that your DataTable contains data would be the place to do this. A simple test would be to check the DataTable.Rows.Count property is greater than zero.
Something like:
SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=TESTDB;Integrated Security=True");
SqlCommand com = new SqlCommand("SELECT * FROM Project WHERE Info=@InfoParam", con);
com.Parameters.AddWithValue("@InfoParam", textBox1.Text);
DataTable dt = new DataTable();
sda.Fill(dt);
if ((dt.Rows.Count>0)&&(dt.Rows[0][0] != DBNull.Value))
{
textBox1.Text = dt.Rows[0][0].ToString();
textBox2.Text = dt.Rows[0][1].ToString();
textBox3.Text = dt.Rows[0][2].ToString();
textBox4.Text = dt.Rows[0][3].ToString();
}
else
{
MessageBox.Show ("Please Check Info!");
}
... hope it helps.