1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
using System;
using System.Data;
using FirebirdSql.Data.FirebirdClient;
namespace FBIRDCONN1
{
public class Test
{
public static void Main(string[] args)
{
string connectionString =
"Database=10.0.0.11/3050:PJV3;" +
"User=SYSDBA;" + "Password=masterkey;" +
"Dialect=3;" + "Server=localhost;" +
"Charset=WIN1252";
FbConnection dbcon = new FbConnection(connectionString);
dbcon.Open();
FbCommand dbcmd = dbcon.CreateCommand();
string sql = "SELECT FIRST 6 * FROM G_A_OSLIST";
dbcmd.CommandText = sql;
FbDataReader reader = dbcmd.ExecuteReader();
int i = 0;
while (reader.Read())
{
for (int j = 0; j < reader.FieldCount; j++)
{
Console.WriteLine("Record: {0}, {1} = {2}",
i,reader.GetName(j),
reader.GetValue(j).ToString().Trim());
}
i++;
}
Console.ReadLine();
// clean up
reader.Close();
reader = null;
dbcmd.Dispose();
dbcmd = null;
dbcon.Close();
dbcon = null;
}
}
} |
Partager