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;
- namespace Imenik
- {
- public partial class dodavanje : Form
- {
- public dodavanje()
- {
- InitializeComponent();
- }
- private void dodaj_Click(object sender, EventArgs e)
- {
- string Query="insert into imenik.imenik (Ime, Prezime, Broj telefona, Opis) values('"+this.ime_txt.Text+"' , '"+this.prezime_txt.Text+"' , '"+this.brojtel_txt.Text+"' , '"+this.opis_txt.Text+"') ;";
- string constring = "datasource=localhost; port=3306; username=root; password=123";
- MySQLConnection con = new MySQLConnection();
- MySql.Data.MySqlClient.MySqlCommand cmdDataBase = new MySql.Data.MySqlClient.MySqlCommand(Query, con);
- try{
- con.Connect();
- cmdDataBase.ExecuteNonQuery();
- MessageBox.Show("Sacuvano");
- }catch(Exception ex){
- MessageBox.Show(ex.Message);
- }
- finally {
- con.Close();
- }
- }
- private void dodavanje_Load(object sender, EventArgs e)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement