Skip to content

Instantly share code, notes, and snippets.

@mariuz

mariuz/Main.cs

Created Dec 15, 2008
Embed
What would you like to do?
// 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
You can’t perform that action at this time.