Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void btnSave_Click(object sender, EventArgs e)
- {
- string constring = "datasource=localhost;port=3306;username=root;password=root";
- 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 + "') ;";
- MySqlConnection connDataBase = new MySqlConnection(constring);
- MySqlCommand cmdDataBase = new MySqlCommand(QueryAdd, connDataBase);
- MySqlDataReader myReader;
- try
- {
- connDataBase.Open();
- myReader = cmdDataBase.ExecuteReader();
- MessageBox.Show("Saved");
- while (myReader.Read())
- {
- }
- }catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement