|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Ent Library. Substitute data from app.config?I have been searching the internet for 12+ hours on how to do this. At this point I'm about to give up. I am using VB .Net 2.0 with the enterprise library jan 2006 release. This is my first time using it and I'm a novice to .Net. I am using the data access quickstart solution and I just started adding my own forms and stuff to it. I got my sql query to work and populate a dataview on my new form with just a few lines of code. Here is my problem :
I work in an environment where we have 2000+ MS SQL servers. My app will use a text box to get the name of the server you wish to connect to and retrieve data. The ent lib seems to have the server name hard coded in the app.config file. When I use my createdatabase method how do I substitute a different server name from the one in the app.config? I need this to be as simple as possible becase I am a novice and might not be able to implement something that is too complex. --------------= Posted using GrabIt =---------------- ------= Binary Usenet downloading made easy =--------- -= Get GrabIt for free from http://www.shemes.com/ =- Malice,
If there is one type of file not hardcoded than it are config files. Do you not see that? Cor Show quoteHide quote "malice" <m**@u.com> schreef in bericht news:44538c87$0$160$892e0abb@auth.newsreader.octanews.com... >I have been searching the internet for 12+ hours on how to do this. At this >point I'm about to give up. I am using VB .Net 2.0 with the enterprise >library jan 2006 release. This is my first time using it and I'm a novice >to .Net. I am using the data access quickstart solution and I just started >adding my own forms and stuff to it. I got my sql query to work and >populate a dataview on my new form with just a few lines of code. Here is >my problem : > I work in an environment where we have 2000+ MS SQL servers. My app will > use a text box to get the name of the server you wish to connect to and > retrieve data. The ent lib seems to have the server name hard coded in the > app.config file. When I use my createdatabase method how do I substitute a > different server name from the one in the app.config? I need this to be as > simple as possible becase I am a novice and might not be able to implement > something that is too complex. > > > --------------= Posted using GrabIt =---------------- > ------= Binary Usenet downloading made easy =--------- > -= Get GrabIt for free from http://www.shemes.com/ =- > Malice,
The CreateDatabase method & the Enterprise Library assume that you have *all* the servers that you can connect to listed in the app.config. Using CreateDatabase() will read the "default" connectionsetting, while using CreateDatabase(name) will read the specified connection setting. If using the Enterprise Library is a "Requirement", then you have 2 options: 1) list all 2000+ MS SQL servers in the connection setting section of the app config. I would recommend you use the configSource attribute in your app.config. 2) Modify CreateDatabase to accept the SQL server name and/or the connection string. I would probably opt for the first over the second, as it allows greater control over the connection string itself, the user only needs to know the "key" to the connection string, which may or may not be the server name itself. Of course the first entails a lot of entries in the app.config, hence the suggestion of the configSource attribute. The second may be a maintenance issue as newer versions of the Enterprise Library are released... For information on using configSource see "Using .NET's configSource attribute" at http://blogs.msdn.com/tomholl/archive/2006/04/02/entlib2externalconfig.aspx If using the Enterprise Library is not a "Requirement", then you have 2 options: 1) list all 2000+ MS SQL servers in the connection setting section of the app config. I would recommend you use the configSource attribute in your app.config. 2) Build the required connection string then passing this to a SqlConnection object. Again the first allows greater control over the connection string itself, while the second would probably more code yet smaller app.config file... -- Hope this helps Jay B. Harlow [MVP - Outlook] ..NET Application Architect, Enthusiast, & Evangelist T.S. Bradley - http://www.tsbradley.net "malice" <m**@u.com> wrote in message point I'm about to give up. I am using VB .Net 2.0 with the enterprise news:44538c87$0$160$892e0abb@auth.newsreader.octanews.com... |I have been searching the internet for 12+ hours on how to do this. At this library jan 2006 release. This is my first time using it and I'm a novice to ..Net. I am using the data access quickstart solution and I just started adding my own forms and stuff to it. I got my sql query to work and populate a dataview on my new form with just a few lines of code. Here is my problem : use a text box to get the name of the server you wish to connect to and | I work in an environment where we have 2000+ MS SQL servers. My app will retrieve data. The ent lib seems to have the server name hard coded in the app.config file. When I use my createdatabase method how do I substitute a different server name from the one in the app.config? I need this to be as simple as possible becase I am a novice and might not be able to implement something that is too complex. Show quoteHide quote | | | --------------= Posted using GrabIt =---------------- | ------= Binary Usenet downloading made easy =--------- | -= Get GrabIt for free from http://www.shemes.com/ =- |
BeginInvoke with a property?
Loading controls with objects versus recordsets DataTable Loop and String Building Is there an easy way to get my Subnet Mask? TAG Property VB 2005 express database problems inheritance question DATAGRID PROBLEM MailMessage to send email with both Text and HTML versions... vb.Script to VB.NET 2005 |
|||||||||||||||||||||||