How to pick data from dataset using C#.Net - Beginner C#.Net Tutorials.

 

Introduction

Today i will explain how to pick data from DataSet using C#.NET.

History

In the Previous articles i explained how to close form on click of the button using C#.nethow to insert record into database from listview control using C#.nethow to backup and restore access database using c#.nethow to backup and restore access database using c#.net, how to fill dataset using c#.net and many more about C#.Net.

Below is the Code For Filling Dataset

 OleDbConnection con = new OleDbConnection("YourConnectionString");
            con.Open();
            OleDbDataAdapter da = new OleDbDataAdapter("select * from table1", con);
            DataSet ds = new DataSet();
            da.Fill(ds);

Create DataSet object.

And Fill DataSet using Fill Function. Pass DataSet object as parameter in Fill Function.

 

Now Next question is how to pick record from DataSet? You can use the Below code :       

 ds.Tables[0].Rows[0]["title"].ToString();

Here we are picking title column from table which is on index no. 1.

Give your Valuable Comments.
comments powered by Disqus
 
Follow me on twitter
About Me
Harpreet Singh
I began programming with C++ when i was 17. Then at the middle of my study .NET came. Then I began to read C# and VB.NET. By the time i learnt SQL and ASP.NET, and developed some websites such as news portals that are active now. Currently i am running my own Software company.
More Articles