> Good day, former programmer delphi in Brazil, needs aid to connect to > firebird 1.5.x in c#.
I use something like this, your mileage might vary (NB. its a cut&paste job and is not tested): public enum Protocol {LOCAL, TCP, SPX} public string getConnectionStringRel(string databasepath, Protocol protocol, string servername ) { FbConnectionStringBuilder csb = new FbConnectionStringBuilder(); csb.UserID = "SYSDBA"; csb.Password = "masterkey"; if (protocol.ToUpper() == Protocol.LOCAL) csb.Database = databasePath; else if (protocol.ToUpper() == Protocol.TCP) csb.Database = serverName + ":" + databasePath; else if (protocol.ToUpper() == Protocol.SPX) csb.Database = serverName + "@" + databasePath; else if (protocol == "Named Pipe") csb.Database = "\\\\"+serverName + "\\" + databasePath; csb.Dialect = 1; //or 3 for modern interbase/firebird csb.ServerType = 0; // not embedded Firebird return csb.ToString(); } private static FbConnection _conn = null; public FbConnection getConnection() { if (_conn==null) { try { _conn = new FbConnection(getConnectionStringRel(@"C:\databases\mydata.gdb", Protocol.LOCAL, "")); _conn.Open(); } catch { return null; } } return _conn; } And then you can do this kind of thing: public FbDataReader GetReader(string querystring) { FbCommand cmd = new FbCommand( querystring, getConnection() ); try { FbDataReader reader = cmd.ExecuteReader(); return reader; } catch { return null; } } ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Firebird-net-provider mailing list Firebird-net-provider@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/firebird-net-provider