Ejemplo n.º 1
0
        public static void PrescriptionList(PrescList preitem)
        {
            string g1Query = string.Format(@"INSERT INTO PRESCRIPTION_LIST (PRE_ID,PET_ID,ORDER_DATE)
VALUES(PREID_SEQ.NEXTVAL,{0},SYSDATE)", Convert.ToInt64(preitem.PetID));

            // Convert.ToInt64 주의

            string hQuery = string.Format(@"select PREID_SEQ.CURRVAL FROM DUAL");

            cmdString = new OracleCommand(g1Query, cntString);
            cmeString = new OracleCommand(hQuery, cntString);
            try
            {
                cntString.Open();
                cmdString.ExecuteNonQuery();

                cmeString.ExecuteNonQuery();
                OracleDataAdapter da = new OracleDataAdapter(cmeString);
                DataTable         dt = new DataTable();
                DataSet           ds = new DataSet();
                da.Fill(dt);
                ds.Tables.Add(dt);

                preitem.PrescID = dt.Rows[0]["CURRVAL"].ToString();
            }

            finally
            {
                cntString.Close();
            }
        }
Ejemplo n.º 2
0
        protected void StartIssue_Click(object sender, EventArgs e)
        {
            PetID = PetIDList.SelectedValue.ToString();

            PrescList newPresc = new PrescList(PrescID, PetID, PrescOrderDate);

            try
            {
                ConnectionClass.PrescriptionList(newPresc);
                ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert(' Success! ');</script>");
                displayPetID.Text   = PetID;
                displayPrescID.Text = newPresc.PrescID;
                // This goes to prescriptionID and array
            }
            catch
            {
                ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('failed');</script>");
            }

            finally
            {
            }
        }