private void btnAddNew_Click(object sender, EventArgs e) { int iAUID = -1; auFlds au = new auFlds(); if (au.Read_Val_GUI(this, iAUID) != 1) { MessageBox.Show("Record not updated"); } else { DataSet ds = new travdataDataSet(); DataTable tbl = new travdataDataSet.auDataTable(); DataRow row = tbl.NewRow(); row["AUID"] = au.AUID;//need to be -1; row["FName"] = au.FName; row["SName"] = au.SName; row["Email"] = au.Email; row["Pword"] = au.Pword; row["ULevel"] = au.ULevel; row["ATag"] = au.ATag; if (Convert.ToInt16(row["AUID"].ToString()) == -1) { dmMain.Add_Rec(row); this.auTableAdapter.Fill(this.travdataDataSet.au); ReadDataGridRow(); } } }
private void btnUpdatePeg_Click(object sender, EventArgs e) { // String s = auDataGridView.Columns[2].HeaderText; // String s = auDataGridView.Rows[2].Cells["dataGridViewTextBoxColumn2"].Value.ToString(); string sAUID = auDataGridView.CurrentRow.Cells[GetFldIdx(auDataGridView, "AUID")].Value.ToString(); int iAUID = Convert.ToInt32(sAUID); auFlds au = new auFlds(); if (au.Read_Val_GUI(this, iAUID) != 1) { MessageBox.Show("Record not updated"); } else { DataTable tbl = new travdataDataSet.auDataTable(); DataRow row = tbl.NewRow(); string[] idx = { "AUID" }; row["AUID"] = au.AUID; row["FName"] = au.FName; row["SName"] = au.SName; row["Email"] = au.Email; row["Pword"] = au.Pword; row["ULevel"] = au.ULevel; row["ATag"] = au.ATag; if (Convert.ToInt16(row["AUID"].ToString()) > -1) { dmMain.Update_Rec(idx, row); this.auTableAdapter.Fill(this.travdataDataSet.au); ReadDataGridRow(); } } }