Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
Node is saved as draft in My Content >> Draft
  • DataSet in .NET

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 45
    Comment on it

    ADO.NET mainly work with the data that we get from the data source.

    While retrieving data we can get it using the connected approach or using the disconnected approach .

    For retrieval we don't need to open and close the database and table connection.

     

    Dataset is the collection of DataTables where multiple tables data can be stored.

     

     

    So if we want multiple table to be returned we have to store it in the dataset.

     

    class Program
    {
        static void Main()
        {
    	// Create two DataTable instances.
    	DataTable table1 = new DataTable("patients");
    	table1.Columns.Add("name");
    	table1.Columns.Add("id");
    	table1.Rows.Add("sam", 1);
    	table1.Rows.Add("mark", 2);
    
    	DataTable table2 = new DataTable("medications");
    	table2.Columns.Add("id");
    	table2.Columns.Add("medication");
    	table2.Rows.Add(1, "atenolol");
    	table2.Rows.Add(2, "amoxicillin");
    
    	// Create a DataSet and put both tables in it.
    	DataSet set = new DataSet("office");
    	set.Tables.Add(table1);
    	set.Tables.Add(table2);
    
    	// Visualize DataSet.
    	Console.WriteLine(set.GetXml());
        }
    }
    .net

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: