Skip to content

Instantly share code, notes, and snippets.

@hrzafer
Created November 29, 2015 20:19
Show Gist options
  • Save hrzafer/68a35cc80fd6c003763f to your computer and use it in GitHub Desktop.
Save hrzafer/68a35cc80fd6c003763f to your computer and use it in GitHub Desktop.
using System;
using System.Text;
using FirebirdSql.Data.FirebirdClient;
namespace FirebirdExample
{
internal class FirebirdSample
{
private static void Main(string[] args)
{
var connectionString = "User ID=sysdba;Password=masterkey;" +
@"Database=localhost:D:\firebird\SAKILA.FDB;" +
"Charset=NONE;";
var sql = "SELECT * FROM ACTOR";
try
{
using (var conn = new FbConnection(connectionString))
{
conn.Open();
using (var command = new FbCommand(sql, conn))
{
using (var reader = command.ExecuteReader())
{
var sb = new StringBuilder();
while (reader.Read())
{
for (var i = 0; i < reader.FieldCount; i++)
{
var data = reader[i].ToString();
Console.Write(data + '\t');
}
Console.WriteLine('\n');
}
}
}
}
}
catch (Exception e)
{
Console.WriteLine($"Veritabanı Hatası: {e.Message}");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment