C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » .NET »

Datatable VS Dataset


Posted Date: 05 Oct 2008      Posted By: Kowsik      Member Level: Silver     Points: 1   Responses: 4



What is the difference between datatable and dataset?




Responses

Author: Antony s Nasarath    05 Oct 2008Member Level: SilverRating: 2 out of 52 out of 5     Points: 2

Hi,

Dataset consists of one or more datatable and as you know, datatable contains rows and columns as in normal table.

You can get datatable from dataset as follows (C# code)
DataTable tbl = DataSet.Tables["Tablename" or Table instance number]

Cheers,



Author: amitkumar    05 Oct 2008Member Level: GoldRating:     Points: -20

HI,
1)Data table is a collection of record's that consist the single table

Whenever dataset is collection of data table and it is provide interface between database and datatable
1 dataset consist multiple table.
2)
Dataset: Represents an in-memory cache of data.

Datatable: Represents one table of in-memory data.



Author: Anand Upadhyay    06 Oct 2008Member Level: BronzeRating:     Points: -20

A Dataset is a in memory representation of a collection of Database objects including tables of a relational database scheme. The dataset contains a collection of Tables, Relations, constraints etc.,

It can be used for manipulating the data remotely and finally updating the database with the modified data. This way it enables disconnected means of working with data. This improves performance in terms of reducing the number of times a database is accessed for data manipulations

The dataset contains all the objects as a Collection of objects. For example it contains the Database Tables as DataTable objects




using System.Data.SqlClient;
using System.Data;

string strDBConnection = "server=(local);database=DatabaseName;user id=UserName;password=Pwd;connection reset=false;connection lifetime=5;Trusted_Connection=Yes;"
SqlConnection dbConnection;
dbConnection = new SqlConnection(strDBConnection);

string strSelectSql = "Select * from [DatabaseName].[OwnerName].[TableName] order by FieldName";

//Open the connection
dbConnection.Open();

//Create a command
SqlCommand selectSqlCommand = new SqlCommand(strSelectSql,dbConnection);
SqlDataAdapter sqlData = new SqlDataAdapter(selectSqlCommand);
DataSet dsSelectData = new DataSet();
sqlData.Fill(dsSelectData);



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : Reflection C Sharp
Previous : Oracl Data Base connection
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use