コード例 #1
0
        public void update(order_cust oc)
        {
            SqlConnection con = new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog=egas;Integrated Security=True;Pooling=False");
            SqlDataAdapter da = new SqlDataAdapter("select * from order_from_customer_to_dealer", con);
            DataSet ds = new DataSet();
            da.Fill(ds, "order_from_dealer_to_company");


            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                if (int.Parse(dr[0].ToString()) == oc._order_id)
                {
                    dr.BeginEdit();
                    dr[1] = oc._customer_id;
                    dr[2] = oc._order_date;
                    dr[3] = oc._status;
                    dr[4] = oc._cylinder_id;
                    dr[5] = oc._dealer_id;
                    dr.EndEdit();
                }
            }
            SqlCommandBuilder cb = new SqlCommandBuilder(da);
            da.Update(ds.Tables[0]);

        }
コード例 #2
0
        public order_cust GetData1(int id)
        {
            SqlConnection con = new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog=egas;Integrated Security=True;Pooling=False");
            SqlDataAdapter da = new SqlDataAdapter("select * from order_from_customer_to_dealer", con);
            DataSet ds = new DataSet();
            da.Fill(ds, "order_from_dealer_to_company");
            order_cust oc = new order_cust();

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                if (int.Parse(dr[0].ToString()) == id)
                {
                    oc._order_id = id;
                    oc._customer_id = int.Parse(dr[1].ToString());
                    oc._order_date = (DateTime)dr[2];
                    oc._status = dr[3].ToString();
                    oc._cylinder_id = int.Parse(dr[4].ToString());
                    oc._dealer_id = int.Parse(dr[5].ToString());
                }
            }
            return oc;
        }