If No Data is retrieve then display message
i am retrieving data from database, if no data is retrieve then display message, Currently my page getting crashed.
private void loadbarcodeno()
{
SqlCommand cmde = new SqlCommand("Sp_Ret_ContainerDetail_Code", con);
cmde.CommandType = CommandType.StoredProcedure;
cmde.Parameters.AddWithValue("@CID", txtid.Text);
cmde.Connection = con;
try
{
con.Open();
SqlDataReader sdr = cmde.ExecuteReader();
while (sdr.Read())
{
txtTweght.Text = sdr["weight"].ToString();
txttotalbales.Text = sdr["qty"].ToString();
DDLContno.SelectedValue = sdr["no"].ToString();
txtctweight.Text = sdr["conwt"].ToString();
txtissuebales.Text = sdr["conqty"].ToString();
lbisuid.Text = sdr["I_ID"].ToString();
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
}
}