Created
December 15, 2008 11:12
-
-
Save mariuz/35930 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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