using System;using System.Data;using System.Data.SqlClient;namespace PublicTest{ /// <summary> /// Summary description for Class1. /// </summary> class myClass {
/// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main(string[] args) { // // TODO: Add code to start application here // string strCon = "Server=LOGICON-SERVER1,1433;Database=pubs;integrated security=SSPI;persist security info=False;Connection Timeout=10000;"; string strSQL = "Select au_fname, au_lname, phone from authors where city = 'Oakland'"; SqlConnection myCon = new SqlConnection(strCon); SqlCommand myCom = new SqlCommand(strSQL, myCon);
SqlDataAdapter da = new SqlDataAdapter(myCom); DataSet ds = new DataSet(); da.Fill(ds, "authors"); foreach (DataColumn dc in ds.Tables(0).Columns) { Console.Write("{0,15}", dc.ColumnName); } } }}==============Thanks & Regards,Ravi