Wrox Programmer Forums
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To 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 July 19th, 2006, 04:55 PM
Registered User
 
Join Date: Sep 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default VB App - Connection to SQL

 have a VB.net that while in the development environment was connected up to a development database. Now that the app is being moved to the production environment the connection has to changes.

Here is my problem: All of the DataAdapters were created with the Wizard and that included the connection string. There are 100's of adapters.

How can I change these?

If this were a web app I would have a reusable piece of code that would be called and the move to Production would only take a quick change to the connnection string in that code and not have to touch all the pages....is there the ability to do that in VB.net?

If I'm going to have to touch all the pages I'd rather add something like this rather than change the dbname.

Thanks in advance.

Tim Sweet
 
Old July 19th, 2006, 05:12 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

All creation of object in .NET results in text-based components (which are closed up within Region tags). That's point 1.
Point 2 is that all .NET end components (.DLLs, .EXEs, .ASPXs) have XML based configuration files associated with them, itno which you can put custom properties which are accessed automatically.

Combining 1 & 2, you should be able to set up custom properties identifiying the database connection particulars, which properrties would then be automatically loaded. In the strings that establish the connections of the DataAdapters, substitute references to these custom properties. (You can probably do the lion's share of this work with a global search-and-replace.)





Similar Threads
Thread Thread Starter Forum Replies Last Post
VB 2005 Crystal Report Connection with SQL 2000 blackspear BOOK: Professional Crystal Reports for VS.NET 0 December 3rd, 2008 09:49 AM
Convert a VB.Net app to a web app? furjaw VB.NET 3 September 24th, 2007 12:27 PM
Using Connection Strings - App.config testsubject Visual Studio 2005 1 July 16th, 2007 01:08 AM
Need to connect to SQL DB in VB app codehappy VB How-To 3 April 21st, 2005 12:03 AM
VB.NET App bmains BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 July 23rd, 2004 08:48 AM





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