Geeks With Blogs
Jeremy Ramos Resource blog (C# | ASP.NET | VB | WPF | WSDL | SQL | SharePoint | InfoPath | SSRS | SSIS)

SqlDataAdapter

Use this data adapter object to bind SQL data sources.

OleDbConnection conn = new OleDbConnection(connectionString);

OleDbDataAdapter adapter = new OleDbDataAdapter();

adapter.SelectCommand = new OleDbCommand(query, conn);

DataSet ds = new DataSet();

adapter.Fill(ds);

GridView1.DataSource = ds;

GridView1.DataBind();

conn.Close();

Using SqlDataAdapter Object

Using System.Data.OleDb; // do not forget your namespace
------------------------------



OleDbDataAdapter

Use this data adapter object to bind data sources that uses OLE DB drivers such as MS Access databases.


OleDbConnection conn = new OleDbConnection(connectionString);

OleDbDataAdapter adapter = new OleDbDataAdapter();

adapter.SelectCommand = new OleDbCommand(query, conn);

DataSet ds = new DataSet();

adapter.Fill(ds);

GridView1.DataSource = ds;

GridView1.DataBind();

conn.Close();

Using OleDbDataAdapter Object

Using System.Data.OleDb; // do not forget your namespace
------------------------------


Posted on Thursday, October 30, 2008 10:16 AM Code bucket | Back to top

Related Posts on Geeks With Blogs Matching Categories

Comments on this post: Binding data controls with datasets using SqlDataAdapter

# re: Binding data controls with datasets using SqlDataAdapter
Requesting Gravatar...
thank s for this exemple
Left by tarik benbiba on Nov 17, 2009 1:52 PM

Your comment:
 (will show your gravatar)


Copyright © Jeremy Ramos | Powered by: GeeksWithBlogs.net