/* DataTable Örnek */

 

using System;

using System.Data;

using System.Data.Common;

using System.Data.SqlClient;

 

class Program

{

    static void Main(string[] args)

    {

        SqlConnection sqlConn = new SqlConnection();

        sqlConn.ConnectionString = @"Data Source=localhost;

                                     Integrated Security=SSPI;

                                     Initial Catalog=Northwind";

        String strSql = @"SELECT CompanyName, ContactName

                          FROM Customers

                          ORDER BY CompanyName";

 

        DataTable dt = new DataTable();

        SqlDataAdapter da = new SqlDataAdapter(strSql, sqlConn);

        da.Fill(dt);

       

        foreach (DataRow row in dt.Rows)

        {

            Console.WriteLine(row[0] + ", " + row[1] + "\r\n");

        }

    }

}

  Sponsor link