Guest User

Untitled

a guest
Oct 15th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. SqlConnection con = new SqlConnection("Data source=(local);initial catalog=HesabDariDB;integrated security=true");
  2. SqlCommand cmd = new SqlCommand();
  3. private void FrmTanzimat_Load(object sender, EventArgs e)
  4. {
  5.  
  6. }
  7.  
  8. private void btnSave_Click(object sender, EventArgs e)
  9. {
  10. cmd.Connection = con;
  11. cmd.Parameters.Clear();
  12. cmd.CommandText = "insert into Tanzimat (NameFroshqah,Tel,Mobile,Address.Tozih)values(@a,@b,@c,@d,@e)";
  13. cmd.Parameters.AddWithValue("@a", txtNameFroshgah.Text);
  14. cmd.Parameters.AddWithValue("@b", txtTel.Text);
  15. cmd.Parameters.AddWithValue("@c", txtMobile.Text);
  16. cmd.Parameters.AddWithValue("@d", txtAddress.Text);
  17. cmd.Parameters.AddWithValue("@e", txtTozih.Text);
  18. con.Open();
  19. cmd.ExecuteNonQuery();
  20. con.Close();
  21. MessageBox.Show("done");
  22. }
  23. }
  24.  
  25. CREATE TABLE [dbo].[Tanzimat] (
  26. [idTanzimat] INT IDENTITY (1, 1) NOT NULL,
  27. [NameFroshgah] NVARCHAR (50) NULL,
  28. [Tel] NVARCHAR (50) NULL,
  29. [Mobile] NVARCHAR (50) NULL,
  30. [Address] NVARCHAR (MAX) NULL,
  31. [Tozih] NVARCHAR (MAX) NULL,
  32. CONSTRAINT [PK_Tanzimat] PRIMARY KEY CLUSTERED ([idTanzimat] ASC)
  33. );
Add Comment
Please, Sign In to add comment