473,409 Members | 1,954 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,409 software developers and data experts.

how can I use the connection string in my solution projects?

I have a problem,

I have a libray that will be used for many differents projetcs (like a web project and a windows app project) and I don't know how can I put the connection string in 1 place only.... I mean, I don't wanna to get the connection from different places.

how can I do this? Do I have to create a new project for the connection?

i'm using now putting the connection strings in every project in settings section. I believe that there is a better way to do it.

I appreciate ur help.
Dec 6 '07 #1
3 1099
dip_developer
648 Expert 512MB
I have a problem,

I have a libray that will be used for many differents projetcs (like a web project and a windows app project) and I don't know how can I put the connection string in 1 place only.... I mean, I don't wanna to get the connection from different places.

how can I do this? Do I have to create a new project for the connection?

i'm using now putting the connection strings in every project in settings section. I believe that there is a better way to do it.

I appreciate ur help.
you can easily create a DLL in which you can define a class for your connection string details........
Further whenever you are making an application either Windows or Web you have to reference that particular DLL in your application.....you can access the methods of that particular class then....
Dec 6 '07 #2
I see...

for an exemple, may I create a project named DBConnect in my solution, with a single class with a property that reads the connection of DBConnect settings...

is that the way?

tnx
Dec 6 '07 #3
dip_developer
648 Expert 512MB
I see...

for an exemple, may I create a project named DBConnect in my solution, with a single class with a property that reads the connection of DBConnect settings...

is that the way?

tnx
make a totally different project...say myConnectionStringDetail in .NET............now make this project as a DLL.......in the project properties select the Output type of your project as Class Library......
this will make your project as a DLL...

now whenever you are making any project in .net , either windows or web, just add the reference of that DLL(myConnectionStringDetail )...right click on your project name---->then Add Reference---->under the COM tab you will find your DLL......

Now you can use the methods of your DLL to fetch the connection string details........

in this way your code will be reusable...................
Dec 7 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Bob | last post by:
I have an ASP.NET web application that has been running without any problems for a while. I recently transferred the site to shared hosting and had multiple users start to use the site. The problem...
1
by: GrantS | last post by:
I am unable to get the connection to work with using the app.config file. the connection works when I use 'in line' connection as below:...
1
by: Macca | last post by:
Hi, I have a C# Solution/Application that contain 4 projects. Each of these projects needs at some time to access the same database. I would like to know how to share a single connection...
15
by: Rob Nicholson | last post by:
I'm starting to worry a bit now. We're getting the above error when two users hit the same database/page on an ASP.NET application using ADO.NET, talking to a SQL 7 server. The error is perfectly...
4
by: Bill | last post by:
Hi, I have a instance webservice that a class to businesslayer, however to businesslayer instance a class to datalayer, where effectively it creates the connection with the bank and returns one...
2
by: Brett Wickard | last post by:
I'm having a design brain-cramp. I have an app that needs to have a connection string that can changed by the user.... (basically the same app needs to be able to talk to different databases on...
2
by: gary g. | last post by:
I was wondering if it was possible to store a connection string only once in a single config file, and let it be accessible to every project in the solution (web included). This way if the...
2
by: mfuribondo | last post by:
I have a solution with three projects in it. Two are windows forms applications and the third is a class library. I am trying to deploy the projects which use a single database located in one of...
3
by: Ryan Liu | last post by:
Hi, When i add a connection string FpConnStr from application setting UI in VS 2008, it ends with sth. like: <connectionStrings> <clear /> <add...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.