Bonjour,
je veux afficher des informations sur un datagridview avec une connexion sqlserver. J'ai fait le code suivant:
protected void Page_Load(object sender, EventArgs e)
{
SqlDataSource SqlDataSource1 = new SqlDataSource();
SqlDataSource1.DataSourceMode = SqlDataSourceMode.DataSet;
SqlDataSource1.SelectCommand = " Select substring (MAILET, charindex('@', MAILET) + 1, 4000), NOMET, PRENOMET from Matable ";
BoundField maColonne = new BoundField();
GridView1.Columns.Add(maColonne);
GridView1.DataSource = SqlDataSource1;
GridView1.DataBind();
}
Mon probléme c'est que je ne sais pas comment le relier avec mon connectionstring qui se trouve dans le webconfig que voici:
<connectionStrings>
<add name="projet_gspConnectionString" connectionString="Data Source=monpc\SQLEXPRESS;Initial Catalog=projet;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
J'arrive pas afficher ces informations, pouvez-vous m'aider?
Merci d'avance.