コード例 #1
0
        public void AddNewLmMakingDB(ILM_Making model)
        {
            using (SqlConnection objSqlConn = new SqlConnection(conn))
            {
                string         sql = "SELECT * FROM Table_LM_Making";
                SqlDataAdapter da  = new SqlDataAdapter(sql, conn);
                DataTable      dt  = new DataTable();
                da.Fill(dt);

                if (dt.Rows.Count > 0)
                {
                    DataRow lastRow = dt.Rows[dt.Rows.Count - 1];
                    id = int.Parse(lastRow["making_id"].ToString());
                    id++;
                }

                string query = "INSERT INTO Table_LM_Making VALUES ('" + id + "','" + model.date + "','" + model.lm_type + "','" + model.supplier_name + "','" + model.no_of_lm + "','" + model.username + "','" + model.division + "')";
                InsertDeleteUpdateCommon(query);
            }
        }
コード例 #2
0
        //UPDATE LM MAKING
        public void UpdateLmMakingDB(ILM_Making model)
        {
            string sql = "UPDATE Table_LM_Making SET date='" + model.date + "', lm_type='" + model.lm_type + "', supplier_name='" + model.supplier_name + "', no_of_lm='" + model.no_of_lm + "', username='******' WHERE making_id='" + model.making_id + "' AND division='" + model.division + "'";

            InsertDeleteUpdateCommon(sql);
        }