|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Change SQL Servers for ApplicationI have a small Visual basic.net 2005 application that needs to get data
from SQL servers How can I make the dataset that uses My.setting.connection, use differant servers ie My Setting.Connection="Data Source=SRV1;Initial Catalog=DB1;Integrated Security=True but when used on another site it needs to be My Setting.Connection="Data Source=CustSRV1;Initial Catalog=DB1;Integrated Security=True I use a small dialog to allow the user to input their own server and
database names, store the results in an XML file, then recall it as a variable, something like this My Setting.Connection="Data Source="+strServer+";Initial Catalog="+strDB+";Integrated Security=True"; Show quote "AMP" <al***@penstonall.co.uk> wrote in message news:1168422258.673392.112490@p59g2000hsd.googlegroups.com... >I have a small Visual basic.net 2005 application that needs to get data > from SQL servers > How can I make the dataset that uses My.setting.connection, use > differant servers > > ie > My Setting.Connection="Data Source=SRV1;Initial Catalog=DB1;Integrated > Security=True > > but when used on another site it needs to be > > My Setting.Connection="Data Source=CustSRV1;Initial > Catalog=DB1;Integrated Security=True > The problem with that is the Dataset was generated using the
my.connection string and if you try to change it a below you get an error of "Read Only" Earl wrote: Show quote > I use a small dialog to allow the user to input their own server and > database names, store the results in an XML file, then recall it as a > variable, something like this > > My Setting.Connection="Data Source="+strServer+";Initial > Catalog="+strDB+";Integrated Security=True"; > > "AMP" <al***@penstonall.co.uk> wrote in message > news:1168422258.673392.112490@p59g2000hsd.googlegroups.com... > >I have a small Visual basic.net 2005 application that needs to get data > > from SQL servers > > How can I make the dataset that uses My.setting.connection, use > > differant servers > > > > ie > > My Setting.Connection="Data Source=SRV1;Initial Catalog=DB1;Integrated > > Security=True > > > > but when used on another site it needs to be > > > > My Setting.Connection="Data Source=CustSRV1;Initial > > Catalog=DB1;Integrated Security=True > > I would recommend not using the visual connection object. Just manually set
the dataset.datasource property to whatever sting you create. The visual object just boxes you in, particularly if you wish to move your data code out of the UI layer. Show quote "AMP" <al***@penstonall.co.uk> wrote in message news:1168427330.942291.276030@77g2000hsv.googlegroups.com... > The problem with that is the Dataset was generated using the > my.connection string and if you try to change it a below you get an > error of "Read Only" > > Earl wrote: >> I use a small dialog to allow the user to input their own server and >> database names, store the results in an XML file, then recall it as a >> variable, something like this >> >> My Setting.Connection="Data Source="+strServer+";Initial >> Catalog="+strDB+";Integrated Security=True"; >> >> "AMP" <al***@penstonall.co.uk> wrote in message >> news:1168422258.673392.112490@p59g2000hsd.googlegroups.com... >> >I have a small Visual basic.net 2005 application that needs to get data >> > from SQL servers >> > How can I make the dataset that uses My.setting.connection, use >> > differant servers >> > >> > ie >> > My Setting.Connection="Data Source=SRV1;Initial Catalog=DB1;Integrated >> > Security=True >> > >> > but when used on another site it needs to be >> > >> > My Setting.Connection="Data Source=CustSRV1;Initial >> > Catalog=DB1;Integrated Security=True >> > > Create an alias that points to the desired server. Use the alias in the
ConnectionString as the server/instance name. When you deploy, change the local alias to point to the desired server... See Chapter 9. -- Show quote____________________________________ William (Bill) Vaughn Author, Mentor, Consultant Microsoft MVP INETA Speaker www.betav.com/blog/billva www.betav.com Please reply only to the newsgroup so that others can benefit. This posting is provided "AS IS" with no warranties, and confers no rights. __________________________________ Visit www.hitchhikerguides.net to get more information on my latest book: Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition) and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook) ----------------------------------------------------------------------------------------------------------------------- "AMP" <al***@penstonall.co.uk> wrote in message news:1168422258.673392.112490@p59g2000hsd.googlegroups.com... >I have a small Visual basic.net 2005 application that needs to get data > from SQL servers > How can I make the dataset that uses My.setting.connection, use > differant servers > > ie > My Setting.Connection="Data Source=SRV1;Initial Catalog=DB1;Integrated > Security=True > > but when used on another site it needs to be > > My Setting.Connection="Data Source=CustSRV1;Initial > Catalog=DB1;Integrated Security=True > |
|||||||||||||||||||||||