DotNetFirebird.org DotNetFirebird
Using Firebird SQL in .NET.

DATE Reading Example (C#)

TEST.SQL Script (Testing Database)

Run the following script to create the testing database. It creates a simple table called MYTABLE with a single row. (How to create a database from an SQL script):

CREATE TABLE MYTABLE (
    ID   INTEGER,
    VAL  DATE
);
INSERT INTO MYTABLE (ID, VAL) VALUES (1, '2005-10-01');

Reading values

The following sample prints the values from the column "VAL" to console:

string database = "test.fdb";

CreateEmbeddedDb(database, "test.sql");

FbConnectionStringBuilder csb = new FbConnectionStringBuilder();
csb.ServerType = 1;
csb.Database = database;

using (FbConnection c = new FbConnection(csb.ToString()))
{
	c.Open();
	FbCommand cmd = new FbCommand("SELECT val FROM mytable", c);
				
	using (FbDataReader r = cmd.ExecuteReader())
	{
		while (r.Read())
		{
			DateTime val = r.GetDateTime(0);
			Console.WriteLine("Value: " + val);
		}
	}
}