Created
November 29, 2015 20:19
-
-
Save hrzafer/68a35cc80fd6c003763f 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
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