Advertisement
Guest User

Untitled

a guest
Nov 1st, 2014
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. int MaxRows;
  2. DataSet ds = new DataSet();
  3. int inc = 0;
  4. DatabaseConnection objConnect;
  5. string conString;
  6. public CabinSetting()
  7. {
  8. InitializeComponent();
  9. }
  10.  
  11. private void CabinSetting_Load(object sender, EventArgs e)
  12. {
  13.  
  14. try
  15. {
  16. objConnect = new DatabaseConnection();
  17. conString = Properties.Settings.Default.Database1ConnectionString;
  18. objConnect.connection_string = conString;
  19.  
  20. objConnect.Sql = Properties.Settings.Default.SQL;
  21. ds = objConnect.GetConnection;
  22. MaxRows = ds.Tables[0].Rows.Count;
  23.  
  24. //NavigateRecords();
  25.  
  26.  
  27. }
  28. catch (Exception err)
  29. {
  30. MessageBox.Show(err.Message);
  31. }
  32.  
  33. }
  34.  
  35. private void Button1_Click(object sender, EventArgs e)
  36. {
  37. {
  38.  
  39. DataRow row = ds.Tables[0].NewRow();
  40. row[0] = int.Parse(TextBox1.Text);
  41. row[1] = TextBox2.Text;
  42. row[2] = ComboBox1.Text;
  43.  
  44. ds.Tables[0].NewRow();
  45. try
  46. {
  47.  
  48. objConnect.UpdateDatabase(ds);
  49. MaxRows = MaxRows + 1;
  50. inc = MaxRows - 1;
  51. MessageBox.Show("RECORD INSERTED");
  52.  
  53. }
  54. catch (Exception err)
  55. {
  56. MessageBox.Show(err.Message);
  57. }
  58. }
  59.  
  60. }
  61. }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement