private DataSet1.CustomersRow GetSelectedRow() { String SelectedCustomerID = CustomersDataGridView.CurrentRow.Cells["CustomerID"].Value.ToString(); DataSet1.CustomersRow SelectedRow = NorthwindDataset.Customers.FindByCustomerID(SelectedCustomerID); return(SelectedRow); }
private void AddRowButton_Click(object sender, EventArgs e) { DataSet1.CustomersRow NewRow = (DataSet1.CustomersRow)NorthwindDataset.Customers.NewRow(); NewRow.CustomerID = "WINGT"; NewRow.CompanyName = "Wingtip Toys"; NewRow.ContactName = "Steve Lasker"; NewRow.ContactTitle = "CEO"; NewRow.Address = "1234 Main Street"; NewRow.City = "Buffalo"; NewRow.Region = "NY"; NewRow.PostalCode = "98052"; NewRow.Country = "USA"; NewRow.Phone = "206-555-0111"; NewRow.Fax = "206-555-0112"; try { NorthwindDataset.Customers.Rows.Add(NewRow); } catch (Exception ex) { MessageBox.Show(ex.Message, "Add Row Failed"); } }