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.Windows.Forms;
- using System.Data.SqlClient;
- namespace WindowsFormsApplication1
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- SqlConnection con=new SqlConnection("Data Source=380-KOMPUTER\\SQLEXPRESS;Initial Catalog=Klienci;Integrated Security=True");
- con.Open();
- SqlCommand sc = new SqlCommand("insert into Klienci values('"+txtName.Text+"','"+txtAdres.Text+"','"+txtMiasto.Text+"','"+txtKodpocztowy.Text+"','"+txtWiek.Text+"','"+cmbWiek.Text+"','"+txtTelefon.Text + "','"+txtMail.Text+"','"+txtCena.Text+"','"+txtStyl.Text+"','"+txtInw.Text+"','"+txtChar.Text+"');", con);
- object o = sc.ExecuteNonQuery();
- MessageBox.Show("Klient został dodany do bazy danych.");
- con.Close();
- }
- public static void main(string[] args)
- {
- Application.Run(new Form1());
- }
- private void button2_Click(object sender, EventArgs e)
- {
- Application.Exit();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- // TODO: This line of code loads data into the 'klienciDataSet.Klienci' table. You can move, or remove it, as needed.
- this.klienciTableAdapter.Fill(this.klienciDataSet.Klienci);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement