Check if one of the following are null -
ob.fetch("select * from patient_reg where pname='" + pno + "'");
lblpno.Text = ob.ds.Tables[0].Rows[0].ItemArray[0].ToString();
lbldrname.Text = ob.ds.Tables[0].Rows[0].ItemArray[7].ToString();
lbldept.Text = ob.ds.Tables[0].Rows[0].ItemArray[6].ToString();
lblpname.Text = ob.ds.Tables[0].Rows[0].ItemArray[1].ToString();
lblage.Text = ob.ds.Tables[0].Rows[0].ItemArray[4].ToString();
lblplace.Text = ob.ds.Tables[0].Rows[0].ItemArray[10].ToString();
Since you are using ToString on all of them,
null
will throw errors.
Try using
Convert.ToString()
instead.