Advertisement
Guest User

Untitled

a guest
Jan 8th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. private void btnSave_Click(object sender, EventArgs e)
  2. {
  3. string constring = "datasource=localhost;port=3306;username=root;password=root";
  4. string QueryAdd = "insert into assetmanagement.assets (`AssetId`,`AssetType`,`AssetDescription`,`SerialNumber`,`Barcode`,`Quantity`,`Manufacturer`,`Model`,`Category`,`Condition`,`Location`,`Department`,`DateAcquired`,`InService`,`Supplier`,`Notes`,`AddedBy`,`DateAdded`) values ('" + this.txtAssetId.Text + "','" + this.txtAssetType.Text + "','" + this.txtAssetDesc.Text + "','" + this.txtSerial.Text + "','" + this.txtBarcode.Text + "','" + this.txtQuantity.Text + "','" + this.txtManufacturer.Text + "','" + this.txtModel.Text + "','" + this.txtCategory.Text + "','" + this.txtCondition.Text + "','" + this.txtLocation.Text + "','" + this.txtDepartment.Text + "','" + this.txtDateAcquired.Text + "','" + this.txtInService.Text + "','" + this.txtSupplier.Text + "','" + this.txtNotes.Text + "','" + this.txtAddedBy.Text + "','" + this.txtDateAdded.Text + "') ;";
  5. MySqlConnection connDataBase = new MySqlConnection(constring);
  6. MySqlCommand cmdDataBase = new MySqlCommand(QueryAdd, connDataBase);
  7. MySqlDataReader myReader;
  8. try
  9. {
  10. connDataBase.Open();
  11. myReader = cmdDataBase.ExecuteReader();
  12. MessageBox.Show("Saved");
  13. while (myReader.Read())
  14. {
  15.  
  16. }
  17.  
  18. }catch (Exception ex)
  19. {
  20. MessageBox.Show(ex.Message);
  21. }
  22.  
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement