private void bunifuThinButton1_Click(object sender, EventArgs e) { DataTable dt = new DataTable(); dbconnect db = new dbconnect(); dt = db.ReadValue("Select * From route"); dataGridView1.DataSource = dt; }
private void bunifuThinButton4_Click(object sender, EventArgs e) { DataTable dt = new DataTable(); dbconnect db = new dbconnect(); String id; id = bunifuTextbox1.text; dt = db.ReadValue("Select * From route where '" + id + "' = RouteID"); dataGridView1.DataSource = dt; }
private void bunifuThinButton8_Click(object sender, EventArgs e) { string len = bunifuCustomTextbox5.Text; if (String.IsNullOrEmpty(bunifuCustomTextbox4.Text)) { String error = "Enter Vehicle Number"; label1.Text = error.ToString(); //MessageBox.Show("Enter Driver Name.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (String.IsNullOrEmpty(bunifuCustomTextbox3.Text)) { String error = "Enter Vehicle Type"; label2.Text = error.ToString(); //MessageBox.Show("Enter Contact Number.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (String.IsNullOrEmpty(bunifuCustomTextbox1.Text)) { String error = "Enter Availability"; label3.Text = error.ToString(); //MessageBox.Show("Enter Address.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { //Adding vehicle info DataTable dt = new DataTable(); dbconnect db = new dbconnect(); MySqlConnection con = new MySqlConnection("server=localhost;user id=root;database=harasara"); String insert = "INSERT INTO vehicles (VehicleNumber,VehicleType,Milage,NoOfRepairs,Availability,Notes) VALUES ('" + this.bunifuCustomTextbox4.Text.ToString() + "','" + this.bunifuCustomTextbox3.Text.ToString() + "','" + Convert.ToInt32(this.bunifuCustomTextbox5.Text.ToString()) + "','" + Convert.ToInt32(this.bunifuCustomTextbox6.Text.ToString()) + "','" + this.bunifuCustomTextbox1.Text.ToString() + "','" + this.bunifuCustomTextbox2.Text.ToString() + "')"; MySqlCommand command = new MySqlCommand(insert, con); MySqlDataReader myreader; try { con.Open(); myreader = command.ExecuteReader(); MessageBox.Show("Saved Successfully"); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error"); } } }
private void bunifuThinButton8_Click(object sender, EventArgs e) { //add to route if (String.IsNullOrEmpty(bunifuCustomTextbox3.Text)) { String error = "Enter Distance."; label3.Text = error.ToString(); //MessageBox.Show("Enter Distance.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (String.IsNullOrEmpty(bunifuCustomTextbox4.Text)) { String error = "Enter Route Name."; label4.Text = error.ToString(); //MessageBox.Show("Enter Route Name.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (String.IsNullOrEmpty(bunifuCustomTextbox2.Text)) { String error = "Enter Route Description"; label5.Text = error.ToString(); //MessageBox.Show("Enter Route Description", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { //Adding vehicle info DataTable dt = new DataTable(); dbconnect db = new dbconnect(); MySqlConnection con = new MySqlConnection("server=localhost;user id=root;database=harasara"); String insert = "INSERT INTO route(RouteName,RouteDistance,RouteDescription) VALUES('" + this.bunifuCustomTextbox4.Text.ToString() + "','" + this.bunifuCustomTextbox3.Text.ToString() + "','" + this.bunifuCustomTextbox2.Text.ToString() + "')"; MySqlCommand command = new MySqlCommand(insert, con); MySqlDataReader myreader; try { con.Open(); myreader = command.ExecuteReader(); MessageBox.Show("Saved Successfully"); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error"); } } }
private void bunifuThinButton11_Click(object sender, EventArgs e) { DataTable dt = new DataTable(); dbconnect db = new dbconnect(); dt = db.ReadValue("Select * From route"); dataGridView1.DataSource = dt; bunifuCustomTextbox4.Clear(); bunifuCustomTextbox2.Clear(); bunifuCustomTextbox3.Clear(); bunifuCustomTextbox1.Clear(); label4.Text = ""; label5.Text = ""; label3.Text = ""; }
private void bunifuThinButton9_Click(object sender, EventArgs e) { DataTable dt = new DataTable(); dbconnect db = new dbconnect(); try { dt = db.ReadValue("Select * From vehicles"); dataGridView1.DataSource = dt; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error"); } }
private void button2_Click(object sender, EventArgs e) { try { DataTable dt = new DataTable(); dbconnect db = new dbconnect(); dt = db.ReadValue("Select DriverID,DriverName,ContactNo From driverdetails"); dataGridView1.DataSource = dt; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error"); } }
private void button1_Click(object sender, EventArgs e) { try { DataTable dt = new DataTable(); dbconnect db = new dbconnect(); dt = db.ReadValue("Select employee_id,fname,mobile_no From employee"); dataGridView1.DataSource = dt; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error"); } }
private void bunifuThinButton1_Click(object sender, EventArgs e) { try { DataTable dt = new DataTable(); dbconnect db = new dbconnect(); String id; //String text; id = bunifuTextbox1.text; dt = db.ReadValue("Select * From vehicles where '" + id + "' = VehicleID"); dataGridView1.DataSource = dt; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error"); } }