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 Form1_Load(object sender, EventArgs e) { SqlConnection sqlcon = new SqlConnection("data source = .; initial catalog = ecole;integrated security=sspi"); SqlCommand sqlcmd = new SqlCommand("select * from stagiaire", sqlcon); SqlDataAdapter sqlda = new SqlDataAdapter(); //sqlda.SelectCommand = sqlcmd; if (sqlda.SelectCommand != null) MessageBox.Show("Not null"); //SqlConnection sqlcon = new SqlConnection("data source = .; initial catalog = ecole;integrated security=sspi"); //SqlCommand sqlcmd = new SqlCommand("Insert into stagiaire values(99,'WILL','MED','tdi')", sqlcon); //sqlcon.Open(); //SqlTransaction sqltr = sqlcon.BeginTransaction(); //sqlcmd.Transaction = sqltr; //sqlcmd.ExecuteNonQuery(); //sqlcmd.CommandText = "Insert into stagiaire values(47,'Brat','Dumdum','tri')"; //sqlcmd.ExecuteNonQuery(); //sqltr.Rollback(); //sqlcon.Close(); } } }