Creating advanced dataset RRS feed

  • Question

  • Hi,
    I got two tables in my SQL server database. They both have the same columns with different table name.
    I'm looking to generate a DataSet / Object that will allow me to access the strongly typed properties of the DataSet within the same object.
    Something like having different Fill methods on the dataset, one will reach table A and the other table B.
    The problem with that is the Adapter will not know how to resolve changes to both tables.

    Any ideas?
    Friday, August 7, 2009 2:38 PM


  • Hi Lior83,


    Based on your description, I recommend you use LINQ to SQL since it will save a lot labor. LINQ to SQL is also strong typed.


    For example, you have tables named Stu, Stu1, Stu2…..

    1)    Add a LINQ to SQL item named Stu to the project.

    2)    You can query like this by changing the query command:

                StuDataContext db = new StuDataContext();

                var user1s = db.ExecuteQuery<Stu>("SELECT * FROM [Stu2]");


    Does this works for you? If you have any questions or concerns, please update the thread and we will have a further discussion.



    Best Regards

    Yichun Feng



    • Marked as answer by Yichun_Feng Thursday, August 13, 2009 2:09 AM
    Monday, August 10, 2009 6:46 AM