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 8559435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:02:44+00:00 2026-06-11T16:02:44+00:00

I have .NET project with sync framework and two separate Datasets for MS SQL

  • 0

I have .NET project with sync framework and two separate Datasets for MS SQL and Compact SQL. in my base class I have a generic DataTable object. in my derived classed I assign Typed DataTable to the generic object based on whether the application is operating online or offline: example:

if (online)
    _dataTable = new MSSQLDataSet.Customer;
else
    _dataTable = new CompactSQLDataSet.Customer;

Now every where in my code i have to check and do a cast based on the current network mode like this:

public void changeCustomerID(int ID)
{
    if (online)
        (MSSQLDataSet.CustomerDataTable)_dataTable)[i].CustomerID = value;
    else
        (CompactMSSQLDataSet.CustomerDataTable)_dataTable)[i].CustomerID = value;
 }

but I don’t think this is very efficient and I believe it can be done in a smarter way to only use one line of code by dynamically getting the Type of _dataTable on the run time.

my problem is at the design time, in order to acess datatable porperties such as “CustomerID” it has to be casted to either MSSQLDataSet.CustomerDataTable or CompactMSSQLDataSet.CustomerDataTable.

Is there a way to have a function or a operator to convert the _datatable to its runtime type but still be able to use it’s design time properties which are the same between the two types? something like:

((aType)_dataTable)[i].CustomerID = value;
//or 
GetRuntimeType(_dataTable)[i].CustomerID = value;
  • 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-06-11T16:02:45+00:00Added an answer on June 11, 2026 at 4:02 pm

    You can separate your Dataset from your TableAdapters. You should have ONE dataset (with the corresponding table definitions) and two sets of table adapters: one for SQL an the other for SQL CE.

    http://msdn.microsoft.com/en-us/library/bb384570.aspx

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

Sidebar

Related Questions

I have .NET project using VS 2010 Pro, Some of the class name in
I have used .net framework 4.0 to design my web project I want to
I have C# .net project with SQL Server 2008 written in Visual Studio 2008.
I have a .NET project that I've been compiling with Visual Studio and running
I have a .NET project in VS 2010 that has grown to consist of
I have an ASP.NET project connecting to a database. A web page sends a
I have a vb.net project that loads plugin dlls at runtime to crunch some
I have an ASP.NET project that contains many classes. I am thinking about creating
I have a .NET deployment project. I would like to add a custom uninstall
I have an ASP.NET project which is a front-end to a database. In addition

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.