using System;
using System.Collections.Generic;
using System.Text;
using System.Data.Odbc;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
OdbcConnection DbConnection = new OdbcConnection("DSN=SAMPLE_SHA");
DbConnection.Open();
OdbcCommand DbCommand = DbConnection.CreateCommand();
DbCommand.CommandText = "SELECT * FROM shaji";
OdbcDataReader DbReader = DbCommand.ExecuteReader();
int fCount = DbReader.FieldCount;
Console.Write( ":" );
for ( int i = 0; i < fCount; i ++ )
{
String fName = DbReader.GetName(i);
Console.Write( fName + ":" );
}
Console.WriteLine();
while( DbReader.Read())
{
Console.Write( ":" );
for (int i = 0; i < fCount; i++)
{
String col = DbReader.GetString(i);
Console.Write(col + ":");
}
Console.WriteLine();
}
DbReader.Close();
DbCommand.Dispose();
DbConnection.Close();
}
}
}
Sunday, February 20, 2011
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment