none
what is a dataset actually? and what are the Differences between data source and data set? RRS feed

  • Question

  • When we add a data source to the project (from Data->Add new data source menu) the wizard creates a connection string for connecting to database and retrieving tables of the database, then we can select tables, column or... . by this work. What objects or class will exist to my project? are all data (rows) of tables present in this dataset? (if yes, how can i access this rows?) or only schema of tables are present and I have to create a new connection string and connection object and command to communicate with dataset and fill the dataset's tables? (if yes how?)  
    • Moved by Stephanie Lv Tuesday, February 7, 2012 5:41 AM (From:Database Design)
    Sunday, February 5, 2012 9:34 PM

Answers

  • Hi iman,

    Welcome!

    When you follow the wizard to create a dataset, you will there is datatablenaem.xsd file in your Solution Explorer, it is just the schema and class for typed dataset without any records. You should use Adapter to fill the dataset to retrieve records from database. The connection string has been generated in app.config and the command will be generated by Adapter.

    Have a nice day.


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by iman rahiminia Tuesday, February 7, 2012 11:35 AM
    Tuesday, February 7, 2012 9:16 AM
    Moderator

All replies

  • Hi,

    Data Source contains your connection string and database name, where as data set it contains data from a table or view or stored procedure it contains the actual rows that meets your selection.

     

    http://www.dotnetspider.com/forum/54623-difference-between-Dataset-DataSource.aspx

    I hope this is helpful.

     

    Elmozamil Elamir

    MyBlog


    Please Mark it as Answered if it answered your question
    OR mark it as Helpful if it help you to solve your problem
    Elmozamil Elamir Hamid
    http://elmozamil.blogspot.com
    Monday, February 6, 2012 6:13 AM
  • Hi

    by adding a data source to project (Data->Add new data source menu) that this data source contains a data set are all data (rows) of tables present in this dataset? or i must create a new connection object and command object to communicate with database and fill the dataset's tables? If this is true then why we must create the dataset?

    Monday, February 6, 2012 8:50 AM
  • Hi,

    After you add data source you need to add dataset this dataset will be linked to the specified datasource (Because data source contains connection string).

    That means for each data set you need data source and you may use one data source for many multiple data sets.

     

    I hope this is helpful.

     

    Elmozamil Elamir

    MyBlog


    Please Mark it as Answered if it answered your question
    OR mark it as Helpful if it help you to solve your problem
    Elmozamil Elamir Hamid
    http://elmozamil.blogspot.com
    Monday, February 6, 2012 9:08 AM
  • After i add a datasource and  dataset, (from Data->Add new data source menu) this  DataSet contain all rows of data or I must create  connection object and command object to communicate with database and fill the dataset's tables?

    Monday, February 6, 2012 1:16 PM
  • Hi iman,

    Welcome!

    When you follow the wizard to create a dataset, you will there is datatablenaem.xsd file in your Solution Explorer, it is just the schema and class for typed dataset without any records. You should use Adapter to fill the dataset to retrieve records from database. The connection string has been generated in app.config and the command will be generated by Adapter.

    Have a nice day.


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by iman rahiminia Tuesday, February 7, 2012 11:35 AM
    Tuesday, February 7, 2012 9:16 AM
    Moderator