Important : data initial


SUBMITTED BY: Guest

DATE: Nov. 21, 2013, 12:47 a.m.

FORMAT: Text only

SIZE: 1.7 kB

HITS: 924

  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. namespace WindowsFormsApplication1
  11. {
  12. public partial class Form1 : Form
  13. {
  14. public Form1()
  15. {
  16. InitializeComponent();
  17. }
  18. private void Form1_Load(object sender, EventArgs e)
  19. {
  20. SqlConnection sqlcon = new SqlConnection("data source = .; initial catalog = ecole;integrated security=sspi");
  21. SqlCommand sqlcmd = new SqlCommand("select * from stagiaire", sqlcon);
  22. SqlDataAdapter sqlda = new SqlDataAdapter();
  23. //sqlda.SelectCommand = sqlcmd;
  24. if (sqlda.SelectCommand != null) MessageBox.Show("Not null");
  25. //SqlConnection sqlcon = new SqlConnection("data source = .; initial catalog = ecole;integrated security=sspi");
  26. //SqlCommand sqlcmd = new SqlCommand("Insert into stagiaire values(99,'WILL','MED','tdi')", sqlcon);
  27. //sqlcon.Open();
  28. //SqlTransaction sqltr = sqlcon.BeginTransaction();
  29. //sqlcmd.Transaction = sqltr;
  30. //sqlcmd.ExecuteNonQuery();
  31. //sqlcmd.CommandText = "Insert into stagiaire values(47,'Brat','Dumdum','tri')";
  32. //sqlcmd.ExecuteNonQuery();
  33. //sqltr.Rollback();
  34. //sqlcon.Close();
  35. }
  36. }
  37. }

comments powered by Disqus