public void Delete(int CustomerID) { using (tempdbEntities tde = new tempdbEntities()) { tde.pDelCustomer(CustomerID); } }
public void Update(int CustomerID, string NewCustomerName) { using (tempdbEntities tde = new tempdbEntities()) { tde.pUpdCustomer(CustomerID, NewCustomerName); } }
public void Insert(int CustomerID, string CustomerName) { using (tempdbEntities tde = new tempdbEntities()) { tde.pInsCustomer(CustomerID, CustomerName); } }
DataTable Select() { DataTable retVal = new DataTable(); using (tempdbEntities tde = new tempdbEntities()) { retVal = tde.pSelCustomer(); } return retVal; }
private void buttonSelect_Click(object sender, EventArgs e) { try { tempdbEntities tde = new tempdbEntities(); dataGridViewSelectedData.DataSource = tde.pSelCustomer().ToArray(); } catch (Exception) { MessageBox.Show("Could not select data"); } }
private void buttonDelete_Click(object sender, EventArgs e) { try { using (tempdbEntities tde = new tempdbEntities()) { tde.pDelCustomer(Int32.Parse(textBoxDeleteCustomerID.Text)); } textBoxDeleteCustomerID.Clear(); } catch (Exception) { MessageBox.Show("Could not delete data"); } }
public string Select() { StringBuilder retVal = new StringBuilder(); using (tempdbEntities tde = new tempdbEntities()) { var results = tde.pSelCustomer(); foreach (var item in results) { retVal.AppendLine(item.CustomerId + ", " + item.CustomerName); } } return retVal.ToString(); }
private void buttonInsertCustomer_Click(object sender, EventArgs e) { try { using (tempdbEntities tde = new tempdbEntities()) { tde.pInsCustomer(Int32.Parse(textBoxInsertCustomerID.Text), textBoxInsertCustomerName.Text); } textBoxInsertCustomerID.Clear(); textBoxInsertCustomerName.Clear(); } catch (Exception) { MessageBox.Show("Could not insert data"); } }