dynamically changing connection string between Compact and SQL 2008 at run time RRS feed

  • Question

  • Hi everyone,

    Had a quick question for those more expierenced than me. I'm developing proof of concept for an occasionally Connected program trying to get Visual Studio's AOD Cache integrated into the program. Having partial success I have a program that uses a local SQL Compact 3.5 database file and a remote SQL 2000 database, and information can sync up back and forth without any problem. 

    Now, what I would like to do is use one entry form and depending if teh user is connected or disconected, have that form bound to remote site or local DB file respectively. I've expieremented with changing the connection string at run time, but that seems to only work when the strings are of a similar type (ODBC to ODBC for example)

    So the question is: Is there a way to change the binding source on a datagrid object, at runtime, between a Compact 3.5 DB and a remote SQL DB server? And how is the best way to do this. If it can be done without loading up a pile of Datasets, that would be awesome. 

    Thanks in advance

    Monday, May 25, 2009 10:41 PM


All replies

  • Hi John

    Are you using Microsoft Sync Framework for ADO.NET for your synchronization solution?

    Maria del Mar Alvarez Rohena Microsoft Sync Framework
    Tuesday, May 26, 2009 10:41 PM
  • Yes we were going to try using ADO sync framework (though we haven't experimented using it with SQL Express yet). 

    So far it seems that if we use Compact and Visual Studio's built in .sync object, then our forms have to be connected to either one source or the other (remote OR local) We'd like the forms to be connected to the remote datasource when the program is in teh field away from internet connection, and then when those forms are connected, they will sync data (using ADO sync framework) and then use the same forms to opperate from the remote server. 

    I haven't been able to figure out how to do this with Compact, so have been exploring using SQL Express, but the sync is harder to set up from what I gather. Any suggestions on what local database we should use and how to connect it to our forms for local vs remote usage?


    Wednesday, May 27, 2009 4:02 PM
  • Hi again John

    Although your scenario uses Microsoft Sync Framework for ADO.NET, your issue regarding the DataGrid object is specific to Visual Studio.  I believe the best forum for this question is the Visual Studio Class Designer Forum: http://social.msdn.microsoft.com/Forums/en-US/vsclassdesigner/threads

    The list of all Visual Studio related forums can be found at this link: http://social.msdn.microsoft.com/Forums/en-US/category/visualstudio.


    Maria del Mar Alvarez Rohena Microsoft Sync Framework
    Thursday, May 28, 2009 9:44 PM