We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,497 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

How to manage Firbird connection ?

i have two database addresses in my config.ini.
i am not confirm that which database address is valid for open but one is valid.
i want open connection which is valid but how to use in short code C#; i want write this code into short lines help ?

public void conect()
            {
            if (System.IO.File.Exists("config.ini"))
                {
                String[] INI = System.IO.File.ReadAllLines("config.ini");

                for (int i = 0; i < INI.Length; i++)
                    {
                  if (INI[i].StartsWith("DBPATH_VPN"))
                        {
                        vpn_db = (INI[i].Substring(INI[i].IndexOf("=") + 1));
                        }
                    if (INI[i].StartsWith("PATHDB_VPN"))
                        {
                        db_vpn = (INI[i].Substring(INI[i].IndexOf("=") + 1));
                        }

                    }
                }}
     public void CollectVendas()
     {
      try
      {
       String path = string.Format("DataSource={0}; DataBase={1};User=SYSDBA; Password=masterkey", vpn, vpn_db);
       FbConnection cnn = new FbConnection(path);
       cnn.Open();
       // here i want collect data from database.
      }
      catch
      {
      String path = string.Format("DataSource={0}; DataBase={1};User=SYSDBA; Password=masterkey", vpn, db_vpn);
       FbConnection cnn = new FbConnection(path);
       cnn.Open();
       // here i want collect data from database.
      }
1
Contributor
0
Replies
1
View
system_Broken
Newbie Poster
18 posts since Jul 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0523 seconds using 2.67MB