//public string GetLot() //{ // string result = ""; // string sql = "select top(1) lotgroup from tb_datachecked where wodate='" + DateTime.Now.ToString("yyyyMMdd") + "' order by lotgroup desc "; // DataTable dt = conn.GetDataTable(sql); // if (dt.Rows.Count == 1) // { // result = dt.Rows[0]["lotgroup"].ToString(); // } // else // result = "0"; // return result; //} public void WriteData(string key__, string indate__, string wodate__, string linecode__, string linename__, string shift__, string empname__, string modelcode__, string total__, string goodqty__, string mixqty__, string defqty__, string starttime__, string endtime__) { try { string sql = "Insert into tb_datachecked (keycode,indate,wodate,linecode,linename,shift,empname,modelcode,total,goodqty,mixqty,defqty,starttime,endtime)" + " values('" + key__ + "','" + indate__ + "','" + wodate__ + "','" + linecode__ + "','" + linename__ + "','" + shift__ + "','" + empname__ + "','" + modelcode__ + "'," + total__ + "," + goodqty__ + "," + mixqty__ + "," + defqty__ + ",'" + starttime__ + "','" + endtime__ + "')"; conn.ExecuteNonQuery(sql); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnOK_Click(object sender, EventArgs e) { try { if (txtdef.Text != "") { string sql = "update tb_datachecked set defqty=" + txtdef.Text.Trim() + ", total=" + (totaltmp - deftmp + int.Parse(txtdef.Text.Trim())) + " where keycode='" + keycode + "'"; conn.ExecuteNonQuery(sql); txttotal.Text = (totaltmp - deftmp + int.Parse(txtdef.Text.Trim())).ToString(); lbmassage.Visible = true; } } catch { txtdef.Focus(); } }