Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int MaxRows;
- DataSet ds = new DataSet();
- int inc = 0;
- DatabaseConnection objConnect;
- string conString;
- public CabinSetting()
- {
- InitializeComponent();
- }
- private void CabinSetting_Load(object sender, EventArgs e)
- {
- try
- {
- objConnect = new DatabaseConnection();
- conString = Properties.Settings.Default.Database1ConnectionString;
- objConnect.connection_string = conString;
- objConnect.Sql = Properties.Settings.Default.SQL;
- ds = objConnect.GetConnection;
- MaxRows = ds.Tables[0].Rows.Count;
- //NavigateRecords();
- }
- catch (Exception err)
- {
- MessageBox.Show(err.Message);
- }
- }
- private void Button1_Click(object sender, EventArgs e)
- {
- {
- DataRow row = ds.Tables[0].NewRow();
- row[0] = int.Parse(TextBox1.Text);
- row[1] = TextBox2.Text;
- row[2] = ComboBox1.Text;
- ds.Tables[0].NewRow();
- try
- {
- objConnect.UpdateDatabase(ds);
- MaxRows = MaxRows + 1;
- inc = MaxRows - 1;
- MessageBox.Show("RECORD INSERTED");
- }
- catch (Exception err)
- {
- MessageBox.Show(err.Message);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement