Advertisement
Guest User

kodc#

a guest
Mar 30th, 2017
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.Data.SqlClient;
  10.  
  11. namespace WindowsFormsApplication1
  12. {
  13. public partial class Form1 : Form
  14. {
  15. public Form1()
  16. {
  17. InitializeComponent();
  18. }
  19.  
  20. private void button1_Click(object sender, EventArgs e)
  21. {
  22. SqlConnection con=new SqlConnection("Data Source=380-KOMPUTER\\SQLEXPRESS;Initial Catalog=Klienci;Integrated Security=True");
  23. con.Open();
  24. 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);
  25. object o = sc.ExecuteNonQuery();
  26. MessageBox.Show("Klient został dodany do bazy danych.");
  27. con.Close();
  28. }
  29. public static void main(string[] args)
  30. {
  31. Application.Run(new Form1());
  32.  
  33.  
  34.  
  35.  
  36. }
  37.  
  38. private void button2_Click(object sender, EventArgs e)
  39. {
  40. Application.Exit();
  41. }
  42.  
  43. private void Form1_Load(object sender, EventArgs e)
  44. {
  45. // TODO: This line of code loads data into the 'klienciDataSet.Klienci' table. You can move, or remove it, as needed.
  46. this.klienciTableAdapter.Fill(this.klienciDataSet.Klienci);
  47.  
  48. }
  49.  
  50.  
  51.  
  52.  
  53. }
  54.  
  55.  
  56.  
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement