public static void ViewPrescription(ViewPresc presc) { string pQuery = string.Format(@"SELECT (select name from MEDICATION where id=PRESCRIPTION_DETAIL.MED_ID ) as NAME, MED_ID AS MED_ID, QTY AS QUANTITY FROM PRESCRIPTION_DETAIL WHERE PRE_ID='{0}'", presc.PNumber); cmdString = new OracleCommand(pQuery, cntString); try { cntString.Open(); OracleDataAdapter da = new OracleDataAdapter(cmdString); DataTable dt = new DataTable(); DataSet ds = new DataSet(); da.Fill(dt); ds.Tables.Add(dt); presc.Prescription = ds.Tables[0]; } finally { cntString.Close(); } }
protected void ViewPescription(object sender, EventArgs e) { try { Button btn = (Button)(sender); PrescNum = btn.CommandArgument; PrescID.Text = PrescNum; ViewPresc prescex = new ViewPresc(PrescNum, Prescription); ConnectionClass.ViewPrescription(prescex); SeePresc.DataSource = prescex.Prescription; SeePresc.DataBind(); } catch { ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert(' Error! ');</script>"); } }