473,795 Members | 2,968 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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/ =-

Apr 29 '06 #1
2 1976
Malice,

If there is one type of file not hardcoded than it are config files.

Do you not see that?

Cor

"malice" <ma*@u.com> schreef in bericht
news:44******** *************@a uth.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/ =-

Apr 29 '06 #2
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" connectionsetti ng, while
using CreateDatabase( name) will read the specified connection setting.

If using the Enterprise Library is a "Requiremen t", 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/archiv...nalconfig.aspx

If using the Enterprise Library is not a "Requiremen t", 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" <ma*@u.com> wrote in message
news:44******** *************@a uth.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/ =-
|
Apr 30 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4363
by: Mike Chamberlain | last post by:
Hi all. I'm trying to extend the Microsoft Enterprise Library Data Access Application Block (http://msdn.microsoft.com/library/en-us/dnpag2/html/daab.asp?frame=true) to work with a Borland Interbase database. To do this, I copied and renamed the source files for working with a SQL Server database (SqlCommandWrapper.cs/SqlDatabase.cs to InterbaseCommandWrapper.cs/InterbaseDatabase.cs). I then changed all
0
1501
by: keyway | last post by:
We have recently implemented (enterprise library) data application blocks to VB.NET console applications - very nice. The console apps read an app.config file, which in turn communicates w/ a dataconfiguration.config file for database access. Now we're trying to implement data application blocks in a VB.NET class library, which is called from a classic ASP web site (not an ASP.NET site). Is there a way to utilize the app.config file...
7
2722
by: rockdale | last post by:
hi, I just downloaded Microsoft Enterprise Library Jan 2006 and try to integrate it into my asp.net application. As i am going to connect to mySQL database, I need to include the source code in my project so that I can debug better. But I all those examples I found are reference the compiled dll only. What are the steps to include the source code of Microsoft Enterprise Library into my project? I created a new dir and copy Microsoft...
3
2639
by: Martyn Fewtrell | last post by:
Hi there. First of all let me apologise for this is a somewhat general question to which I would be interested in any opinions. As far as I can see when I create a web application the recommended location for the database is the app_data folder. The recommended location for code files and datasets/table adapters appears to be the app_code folder. This set up appears to work reasonably well although it results in the all the code...
8
2427
by: Mihai Velicu | last post by:
Hi ! I created a class library and in it I have a class that call "ConfigurationManager" to find out what type of database I work and the connection string.When I call this class from a form, everithing is running well, no errors.When I call this class from a custom control I receive the message "Object reference not set to an instance of an object" Does anyoane know what is happening ? Thanks,
6
2812
by: WT | last post by:
Hello, Using VS2005. I have an assembly library that can be called from a Web site asp.net application or from a winform application. From this library I need to retrieve a path using simply a key like 'libPath'. As far as winform and asp.net share the same common base class for settings, SettingsBase, how to manage this ? For winform the value should be set in app.config and for web site in
7
10324
by: Peter Bradley | last post by:
OK. A bit behind the times, I know; but we're just moving over to .NET 2.0. How on earth do you manage configuration settings in a class library in .NET 2.0? In version 1.1, we used a handy class called AssemblySettings that someone (I forget his name) had written. When the class library was finished, you deployed it to the GAC and put the configuration files in the GAC with the class library assembly. This no longer works. In fact...
2
18144
by: bz | last post by:
Hi, I have a library project that implements a Business Layer for a web and a desktop application All my business classes are in this lib, so I have here the connection string to database as app setting (in app.config The section in app.config looks like this <applicationSettings>
2
2853
by: =?Utf-8?B?SGVsZW4gVHJpbQ==?= | last post by:
I have a web method that I want to improve by using the Enterprise Library Data block. I have added the Microsoft.Practices.EnterpriseLibrary.Data.dll and Microsoft.Practices.EnterpriseLibrary.Data.xml references to my project but I can't work out how to use them. The Help is confusing and I can't find any examples anywhere. Please can someone tell me how to convert the following code? It is written in Visual Studio 2005 in C# and it...
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10165
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9043
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7541
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6783
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3727
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.