Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.Data.SqlClient;
- using MySql.Data;
- using MySql.Data.MySqlClient;
- namespace Imenik
- {
- public partial class izmjena : Form
- {
- public izmjena()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- private void izmjeni_bt_Click(object sender, EventArgs e)
- {
- string Query = "update imenik.imenik set ID='" + this.ID_txt.Text + "', Ime='" + this.ime_txt.Text + "' ,Prezime= '" + this.prezime_txt.Text + "' ,Broj_telefona= '" + this.brojtel_txt.Text + "' ,Opis= '" + this.opis_txt.Text + "', where ID=" + this.ID_txt.Text + " ;";
- string constring = "datasource=localhost; port=3306; username=root; password=123";
- MySqlConnection con = new MySqlConnection(constring);
- MySql.Data.MySqlClient.MySqlCommand cmdDataBase = new MySql.Data.MySqlClient.MySqlCommand(Query, con);
- try
- {
- con.Open();
- cmdDataBase.ExecuteNonQuery();
- MessageBox.Show("Sacuvano");
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- finally
- {
- con.Close();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement