indradeo says:
sdr.Read();
txt_Mtrl_cd.Text = sdr[
"Mtrl_cd"
].ToString();
txt_dsc.Text = sdr[
"Mtrl_dscrptn"
].ToString();
Labelttl1.Text = sdr[
"quntty_req"
].ToString();
Before setting the value check if there are rows on not.
Using if condition.
if(sdr.Read())
{
txt_Mtrl_cd.Text = sdr["Mtrl_cd"].ToString();
txt_dsc.Text = sdr["Mtrl_dscrptn"].ToString();
Labelttl1.Text = sdr["quntty_req"].ToString();
}
Or using HasRows property.
sdr.Read();
if (sdr.HasRows)
{
txt_Mtrl_cd.Text = sdr["Mtrl_cd"].ToString();
txt_dsc.Text = sdr["Mtrl_dscrptn"].ToString();
Labelttl1.Text = sdr["quntty_req"].ToString();
}