void compactrepair(object sender, EventArgs e) { createdb createdb = new createdb(); createdb.backupdatabase(); createdb.compactandrepair(gv.connstr, gv.mdbfile); }
void insert() { SaveFileDialog dialog = new SaveFileDialog { RestoreDirectory = true, OverwritePrompt = true, Filter = "Access Database(*.mdb)|*.mdb" }; if (dialog.ShowDialog() == DialogResult.OK) { string filename = dialog.FileName; insertlist(filename); createdb cdb = new createdb(); cdb.create(); try { gv.conn.Open(); Num = 1; Int32.TryParse(tb15.Text, out int port); gv.sql = "insert into bill (id, firmname, address, email,emailpassword, phone1, phone2, phone3,vatnumber, dlno20b, logofile, company1, brandname, godname, smtp, port,startdate, enddate ) " + "values(@id,@firmname, @address, @email,@emailpassword, @phone1, @phone2, @phone3,@vatnumber, @dlno20b, @logofile, @company1, @brandname, @godname, @smtp,@port,@startdate,@enddate) "; Debug.WriteLine(gv.sql); gv.adap.InsertCommand = new OleDbCommand(gv.sql, gv.conn); gv.adap.InsertCommand.Parameters.AddWithValue("@id", Num); gv.adap.InsertCommand.Parameters.AddWithValue("@firmname", tb1.Text); gv.adap.InsertCommand.Parameters.AddWithValue("@address", tb2.Text); gv.adap.InsertCommand.Parameters.AddWithValue("@email", tb3.Text); gv.adap.InsertCommand.Parameters.AddWithValue("@emailpassword", tb4.Text); gv.adap.InsertCommand.Parameters.AddWithValue("@phone1", tb5.Text); gv.adap.InsertCommand.Parameters.AddWithValue("@phone2", tb6.Text); gv.adap.InsertCommand.Parameters.AddWithValue("@phone3", tb7.Text); gv.adap.InsertCommand.Parameters.AddWithValue("@vatnumber", tb8.Text); gv.adap.InsertCommand.Parameters.AddWithValue("@dlno20b", tb9.Text); gv.adap.InsertCommand.Parameters.AddWithValue("@logofile", tb10.Text); gv.adap.InsertCommand.Parameters.AddWithValue("@company1", tb11.Text); gv.adap.InsertCommand.Parameters.AddWithValue("@brandname", tb12.Text); gv.adap.InsertCommand.Parameters.AddWithValue("@godname", tb13.Text); gv.adap.InsertCommand.Parameters.AddWithValue("@smtp", tb14.Text); gv.adap.InsertCommand.Parameters.AddWithValue("@port", tb15.Text); gv.adap.InsertCommand.Parameters.Add("@startdate", OleDbType.Date).Value = dtp1.Value; gv.adap.InsertCommand.Parameters.AddWithValue("@startdate", dtp1.Value.ToString("MM/dd/yyyy")); gv.adap.InsertCommand.Parameters.AddWithValue("@enddate", dtp2.Value.ToString("MM/dd/yyyy")); gv.adap.InsertCommand.ExecuteNonQuery(); } catch (Exception Ex) { MessageBox.Show(Ex.Message); } finally { gv.conn.Close(); } } }
void backup(object sender, EventArgs e) { createdb createdb = new createdb(); createdb.backupdatabase(); }
void checkstructure(object sender, EventArgs e) { createdb createdb = new createdb(); createdb.create(); }
public HomeController(createdb context) { db = context; }