private void btnAddP_Click(object sender, EventArgs e) { try { //添加一行数据,对相应数据进行填充 DataRow newrow = dsP.Tables[0].NewRow(); newrow["InPut_Time"] = DateTime.Now; newrow["Check_Date"] = DateTime.Now; newrow["Lance_Head_Type"] = strType; newrow["LanceID"] = strdvLanceID;; newrow["MakeID"] = strdvMakeID; newrow["ShiftID"] = "2"; newrow["Operator"] = Adapter.Session.User; dsP.Tables[0].Rows.Add(newrow); bsP.MoveFirst();// while (((System.Data.DataRowView)(bsP.Current)).Row != newrow && bsP.Position != dsP.Tables[0].Rows.Count - 1) { bsP.MoveNext(); } LanceDefendMagShowFrm DefendFrm = new LanceDefendMagShowFrm(); DefendFrm.ShowDialogEx(Adapter.Session, bsP.Position, strSortP, ref dsP); //GC.Collect(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "异常", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void dvP_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.RowIndex >= 0 && dsM.Tables[0].Rows.Count > 0) { bsP.Position = e.RowIndex; LanceDefendMagShowFrm DefendFrm = new LanceDefendMagShowFrm(); DefendFrm.ShowDialogEx(Adapter.Session, bsP.Position, strSortP, ref dsP); GC.Collect(); } }