A
Alessandro Francisco
Hi,
I create this code #, to test a connection to Firebird SQL Server.
But i don't know fetch up the data selected, samebody can help-me?
--
Regards,
Alessandro
(e-mail address removed)
C#.Net & Firebird SQL Server
#
#region Using directives
using System;
using System.Collections.Generic;
using System.Text;
using FirebirdSql.Data.Firebird;
#endregion
namespace ConsoleApplication1
{
class Program
{
public static void Main(string[] args)
{
Console.WriteLine("<<");
//Define the connectio params, password, user, database file, and others
string connString =
"User=SYSDBA;" +
"Password=masterkey;" +
@"Database=d:\infotech.db;" + //@ to not use:"d:\\infotech.db"!
"DataSource=localhost;" +
"Dialect=3;" +
"Charset=WIN1252;";
//Start de connetion
FbConnection connInfotech = new FbConnection(connString);
connInfotech.Open();
//Create the command and transaction
FbCommand connQuery = new FbCommand();
FbTransaction transaction;
//Start local transaction
transaction = connInfotech.BeginTransaction();
//Atach connection and transaction to command
connQuery.Connection = connInfotech;
connQuery.Transaction = transaction;
connQuery.CommandText = "SELECT * FROM TB_CIDADES";
//Fileds from this table (CID_CODIGO int, CID_NOME string)
//Create de Reader ??? I don't know use this
FbDataReader dtreQuery = connQuery.ExecuteReader();
//Return record count
Console.WriteLine(dtreQuery.FieldCount);
//Close command and connection
dtreQuery.Close();
connInfotech.Close();
Console.WriteLine(">>");
}
}
}
I create this code #, to test a connection to Firebird SQL Server.
But i don't know fetch up the data selected, samebody can help-me?
--
Regards,
Alessandro
(e-mail address removed)
C#.Net & Firebird SQL Server
#
#region Using directives
using System;
using System.Collections.Generic;
using System.Text;
using FirebirdSql.Data.Firebird;
#endregion
namespace ConsoleApplication1
{
class Program
{
public static void Main(string[] args)
{
Console.WriteLine("<<");
//Define the connectio params, password, user, database file, and others
string connString =
"User=SYSDBA;" +
"Password=masterkey;" +
@"Database=d:\infotech.db;" + //@ to not use:"d:\\infotech.db"!
"DataSource=localhost;" +
"Dialect=3;" +
"Charset=WIN1252;";
//Start de connetion
FbConnection connInfotech = new FbConnection(connString);
connInfotech.Open();
//Create the command and transaction
FbCommand connQuery = new FbCommand();
FbTransaction transaction;
//Start local transaction
transaction = connInfotech.BeginTransaction();
//Atach connection and transaction to command
connQuery.Connection = connInfotech;
connQuery.Transaction = transaction;
connQuery.CommandText = "SELECT * FROM TB_CIDADES";
//Fileds from this table (CID_CODIGO int, CID_NOME string)
//Create de Reader ??? I don't know use this
FbDataReader dtreQuery = connQuery.ExecuteReader();
//Return record count
Console.WriteLine(dtreQuery.FieldCount);
//Close command and connection
dtreQuery.Close();
connInfotech.Close();
Console.WriteLine(">>");
}
}
}