Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 196317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:45:25+00:00 2026-05-11T16:45:25+00:00

I need to create a strongly typed dataset during run-time for the user preferred

  • 0

I need to create a strongly typed dataset during run-time for the user preferred target database. Visual studio has massive design time support for creating typed datasets. I need to automate the process of generating typed datasets for the target database at runtime.

It should create…

1.) XSD file.

2.) Typed dataset represnting the Database

3.) Typed wrappers for all database tables and columns within the tables.

4.) TableAdapters for each table.

So I need to generate the same typed dataset at runtime which is generally created while design time using Typed dataset designer of the Visual Studio.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T16:45:26+00:00Added an answer on May 11, 2026 at 4:45 pm

    I tend to agree with jcollum on this one, using a Typed Dataset at runtime is probably the wrong way to go. If on the other hand, you just want to be able to get structured data ( aka, a DataTable ) from a database at runtime, you could use reflection to create a TableAdapter from an arbitrary data result.

    var results = (from data in db.SomeTable select data).ToArray();
    DataTable dt = ObjectArrayToDataTable(results);
    // At this point you have a properly structure DataTable.
    
    // Here is your XSD, if absolutely needed.
    dt.WriteXMLSchema("c:\somepath\somefilename.xsd");
    
    private static System.Data.DataTable ObjectArrayToDataTable(object[] data)
    {
        System.Data.DataTable dt = new System.Data.DataTable();
        // if data is empty, return an empty table
        if (data.Length == 0) return dt;
    
        Type t = data[0].GetType();
        System.Reflection.PropertyInfo[] piList = t.GetProperties();
    
        foreach (System.Reflection.PropertyInfo p in piList)
        {
            dt.Columns.Add(new System.Data.DataColumn(p.Name, p.PropertyType));
        }
    
        object[] row = new object[piList.Length];
    
        foreach (object obj in data)
        {
            int i = 0;
            foreach (System.Reflection.PropertyInfo pi in piList)
            {
                row[i++] = pi.GetValue(obj, null);
            }
            dt.Rows.Add(row);
        }
    
        return dt;
    }
    

    You could apply the same principal to create a structured DataSet and easily create a DataAdapter to it.

    Or perhaps I am mis-reading your requirements.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 248k
  • Answers 248k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer For an introduction to the concept, see Wikipedia. For use… May 13, 2026 at 8:54 am
  • Editorial Team
    Editorial Team added an answer Have you checked the FCKeditor configuration file for the correct… May 13, 2026 at 8:54 am
  • Editorial Team
    Editorial Team added an answer Map: function(doc) { switch (doc.type) { case "idea": emit(doc._id, ["idea",… May 13, 2026 at 8:54 am

Related Questions

Please keep in mind that I'm new to C# and OOP so I apologize
I have a C# Windows Forms application, whose prototype was created on SQL Server
Edit: I am using SqlDataAdapters to fill the data sets. Sorry--I should have been
I'm playing around at the start of a personal project in C# and MySQL.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.