Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 28th, 2006, 09:08 PM
blintrell blintrell is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2006
Posts: 11 blintrell User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 14 m 56 sec
Reputation Power: 0
Exclamation Create one connection string for firebird in VS 2005

Hi

How do I create one connection string for firebird in VS 2005 so that I would not have to type everytime I want to connect to the database.

I am creating a windows application using Visual Studio 2005. The language that I am using is C#.

Please help and advice. Please give out examples as well on how or where do I do this one connection string so that I do not need to write a connection string in every window forms that I created.

Thanks in advance.

Reply With Quote
  #2  
Old May 28th, 2006, 10:50 PM
blintrell blintrell is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2006
Posts: 11 blintrell User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 14 m 56 sec
Reputation Power: 0
I already got the solution.
Here is the solution for everyone.

Add a App.config file (*.config)
Type for example:-

Code:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="DB_CONN_STRING" 
         value="User=SYSDBA;Password=masterkey;Database=C:\\MYPROJECT\\DATABASE\\MYDB.FDB"/>
  </appSettings>
</configuration>


Then add reference --> System.Configuration

Then within your windows form do this on top... at the beginning (i guess)

Code:
string strConnectionString = System.Configuration.ConfigurationManager.AppSettings["DB_CONN_STRING"];


done!

To use it just like this:-

Code:
FbConnection c = new FbConnection(strConnectionString);

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > Create one connection string for firebird in VS 2005


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT