Hi, Write this code in try,
Catch block and debug it line by line code change like
try {
if (DropDownListProject.SelectedIndex != 0)
{
string strTrans = string.Empty;
string _Query="select TransportAgency from project where proCode='" + DropDownListProject.SelectedValue.ToString() + "'";
SqlCommand cmd = new SqlCommand(_Query, con);
con.Open();
strTrans = (string)
cmd.ExecuteScalar();
con.Close();
txtTransport.Text = strTrans;
}
}
catch(Exception ex)
{
lblMsg.ForeColor=System.Drawing.Color.Red;
lblMsg.Text="Error:"+ex.Message;
}