Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Visual Basic 2005 Basics
|
Visual Basic 2005 Basics If you are new to Visual Basic programming with version 2005, this is the place to start your questions. For questions about the book: Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome, ISBN: 0-7645-7401-9 please, use this forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2005 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 29th, 2007, 12:33 PM
Registered User
 
Join Date: Apr 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default DataSet/XSD files instead of Run Time Code

Hey guys. I am an old VB6 programmer that is trying to learn VB 2005 and, particularly, ADO.NET. I have the basics down and am pretty much able to get around but there is one nagging question that I cannot seem to find a definitive answer one (I think it is no but wanted someone to confirm).

If I used the Wizard/GUI that comes with VS05 to build my database connections and adapters to, say, and Access MDB file, can I change the source database (via the connection string) to a different MDB that the user would select? From what I can tell, the connectionstring is hard-coded in the app.config file the moment you insert a data source using the wizard in "Data Sources". This, I have concluded, is a read only property and cannot be changed in Run Time.

What I need the app to eventually do is have the ability to select different source database that the user select. For example, a new MDB file will be generated every day by the User 1 (always with the same structure, just new/different records). This app has to be able to allow another, User 2, to navigate and select the new days MDB (via a dialog box), pull in the data, and process it. So if I use the GUI for database connectivity (which is really nice), it seems like the source database could not be changed once compiled. It seems that my options are to either go with some kind of intermediate MDB file that has links to the table of the source database that are somehow repaired by the program or I simply do all of my connects in code that execute at Run Time.

Does that make sense?

Thanks
Ernie

 
Old April 30th, 2007, 12:26 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

OK, time for the blind to lead the blind here...

As I understand it, the connection that is established is established in code, not in configuration domains. You assertion leads me to believe that the IDE is storing the string identifying the data source in app.config for later retrieval. But notwithstanding that, the actual implementation is in code.

That's the first point. The second is that VB05 breaks up the implementation of what you design into more than one code file, using partial classes.

So. To pull these points together, if you can find the code that takes that string from app.config—using it to establish the connection—and re-implement it in areas that respond to users’ actions and your authoring, you should be able to have an app that does what you are striving to do.
 
Old May 16th, 2007, 10:41 AM
Registered User
 
Join Date: Apr 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Brian. That is exactly what I was thinking. The big question here is "Where is that code that I need to intercept?". You would think there has to be a way to do it. I havent had time to look into this so sorry for the delayed response.

Ernie

 
Old May 25th, 2007, 11:57 AM
Registered User
 
Join Date: May 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

@aesalazar,
this should work..

 Me.RecipeTableAdapter.Connection = 'new connection string'








Similar Threads
Thread Thread Starter Forum Replies Last Post
Run VS.NET 2003 dataset aspx files on VS 2005 cJeffreywang ASP.NET 2.0 Basics 0 October 16th, 2007 07:27 PM
Can't view configs and XSD files correctly!? phrankbooth Visual Studio 2005 1 August 20th, 2007 02:48 PM
Getting a Run-Time Error with this code.. Smythe Access VBA 2 May 28th, 2006 07:06 PM
Merging XSD files in one XSD file by using what? haoxuqian XML 1 November 4th, 2005 01:42 PM
Run-time code execution module0000 Beginning VB 6 1 June 20th, 2003 04:19 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.