コード例 #1
0
        private void Search_2_Click(object sender, EventArgs e)
        {
            connection.Open();
            //string name = TxtDname.Text;
            cmd = new SqlCommand("select * From Drug where D_name =  '" + TxtDname.Text + "' ", connection);
            dr  = cmd.ExecuteReader();

            while (dr.Read())
            {
                TxtDnum.AppendText(dr["D_nom"].ToString());
                TxtDname2.AppendText(dr["D_name"].ToString());
                TxtDprice.AppendText(dr["D_price"].ToString());
                TxtDplace.AppendText(dr["D_place"].ToString());
                TxtDquantity.AppendText(dr["Quantity"].ToString());
                TxtDexdate.AppendText(dr["EX_date"].ToString());
                string mand = dr["prescription"].ToString();
                TxtDclassification.AppendText(dr["classification"].ToString());
                TxtDpdname.AppendText(dr["producer_name"].ToString());
                TxtDpvname.AppendText(dr["provider_num"].ToString());
                TxtDbname.AppendText(dr["Br_num"].ToString());
                //MessageBox.Show(mand);
                if (mand == "True")
                {
                    Mandatory.Checked = true;
                }
                else
                {
                    Mandatory.Checked = false;
                }
                string str  = TxtDexdate.Text;
                string str2 = str.Substring(0, 10);
                TxtDexdate.Text = str2;
            }
            dr.Close();
            connection.Close();
        }
コード例 #2
0
        private void Search_2_Click(object sender, EventArgs e)
        {
            connection.Open();
            //string name = TxtDname.Text;
            cmd = new SqlCommand("select * From Accessories where A_name =  '" + TxtDname.Text + "' ", connection);
            dr  = cmd.ExecuteReader();

            while (dr.Read())
            {
                TxtDnum.AppendText(dr["A_num"].ToString());
                TxtDname2.AppendText(dr["A_name"].ToString());
                TxtDplace.AppendText(dr["A_place"].ToString());
                TxtDquantity.AppendText(dr["Quantity"].ToString());
                TxtDexdate.AppendText(dr["EX_date"].ToString());
                TxtDclassification.AppendText(dr["Classification"].ToString());
                TxtDbname.AppendText(dr["Br_num"].ToString());

                string str  = TxtDexdate.Text;
                string str2 = str.Substring(0, 10);
                TxtDexdate.Text = str2;
            }
            dr.Close();
            connection.Close();
        }