using System;
using System.Data;
using FirebirdSql.Data.Firebird;
public class Test
{
public static void Main(string[] args)
{
string connectionString =
"Database=C:PROGRAM FILESFIREBIRDEXAMPLESEMPLOYEE.GDB;" +
"User=SYSDBA;" +
"Password=masterkey;" +
"Dialect=3;" +
"Server=localhost";
IDbConnection dbcon = new FbConnection(connectionString);
dbcon.Open();
IDbCommand dbcmd = dbcon.CreateCommand();
string sql = "SELECT * FROM employee";
dbcmd.CommandText = sql;
IDataReader reader = dbcmd.ExecuteReader();
while(reader.Read()) {
object dataValue = reader.GetValue(0);
string sValue = dataValue.ToString();
Console.WriteLine("Value: " + sValue);
}
// clean up
reader.Close();
reader = null;
dbcmd.Dispose();
dbcmd = null;
dbcon.Close();
dbcon = null;
}
}
Monday, January 10, 2005
Connecting to Firebird with C#
Posted by Fikret Hasovic at 1/10/2005 11:48:00 AM
Subscribe to:
Post Comments (Atom)
1 comment:
I have started a site devoted to using Firebird in .NET. You can take a look at http://www.dotnetfirebird.org.
Post a Comment