Skip to content

Instantly share code, notes, and snippets.

@mariuz
Created December 15, 2008 11:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mariuz/35930 to your computer and use it in GitHub Desktop.
Save mariuz/35930 to your computer and use it in GitHub Desktop.
// Main.cs created with MonoDevelop
// User: mariuz at 12:37 PM 9/12/2008
//
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
using System;
using System.Data;
using FirebirdSql.Data.Firebird;
namespace firebirdtest
{
class MainClass
{
public static void Main(string[] args) {
string connectionString =
"Database=/var/lib/firebird/2.1/data/employee.fdb;" +
"User=SYSDBA;" + "Password=masterkey;" +
"Dialect=3;character set=NONE;" + "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;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment