1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| private void InitializeComponent()
{
this.dataSet1 = new System.Data.DataSet();
((System.ComponentModel.ISupportInitialize)(this.dataSet1)).BeginInit();
//
// dataSet1
//
this.dataSet1.DataSetName = "NewDataSet";
this.dataSet1.Locale = new System.Globalization.CultureInfo("fr-FR");
this.Load += new System.EventHandler(this.Page_Load);
((System.ComponentModel.ISupportInitialize)(this.dataSet1)).EndInit();
string CheminDeConnexion = @"Server=W260158\SQLEXPRESS;Database=MYdb;uid=DB1;pwd=DB1;";
int trouve = 0;
SqlConnection connexion = new SqlConnection();
connexion.ConnectionString = CheminDeConnexion;
try
{
connexion.Open();
string requete = "select COL_NOM,COL_PRENOM from T_REF_COL";
SqlCommand sql= new SqlCommand(requete.connexion);
SqlDataReader reader = sql.ExecuteReader();
while(reader.Read())
{
string nom;
string prenom;
nom = (string)reader[0];
prenom=(string)reader[1];
}
}
catch (Exception e)
{
;
}
}
#endregion
} |
Partager