Here is a code sample of how to create a dataset and populate the
gridview
DataSet myDataSet = new DataSet("ds1");
string sql = "Select * from Customer";
SqlConnection myConnection = new SqlConnection(@"Data
Source=MYSqlDB;Integrated Security=SSPI;"Initial Catalog=Northwind");
SqlCommand cmd1 = new SqlCommand(sql);
cmd1.CommandType = CommandType.Text;
myConnection.Open();
cmd1.Connection = myConnection;
SqlDataAdapter sqlDAdapt = new SqlDataAdapter();
sqlDAdapt.SelectCommand=cmd1;
sqlDAdapt.Fill(myDataSet,"Account");
myGridView.DataSource = myDataSet.Tables[0];
Let me know if you have any questions
+
On Nov 7, 6:19 am, Mikaël PLOUHINEC <m...@cerealog.frwrote:
Hello,
I work with SQL Server 2005 and a dataset in my VS.NET project. I would
like to use a GridView. Is that possible to use a grid View and
configure his datasource with a View (in SQL Server)?
How can I do that?
Thanks a lot.
Mike