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.
}
Related Article: Connection
is a C# discussion thread by solomon_13000 that has 1 reply, was last updated 1 year ago and has been tagged with the keywords: connection, database, deadlock.
system_Broken
Newbie Poster
18 posts since Jul 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0
© 2013 DaniWeb® LLC
Page rendered in 0.0523 seconds
using 2.67MB