Hi,
if you are getting object reference exception, one of the cause is you are trying to convert null value into ToString.
as you can see in your code
txtBuildNo.Text = dt.Rows[0]["BuildNo"].ToString();
should be changed with
txtBuildNo.Text = Convert.ToString(dt.Rows[0]["BuildNo"]);
similarly check all the casting properly for this exception resolution.
hope this will solve your problem.
thanks
-amit.