DataSet DS = New DataSet ();
System.data.sqlclient.sqlconnection cnn = new system.data.sqlclient.sqlconnection ("Server = (local); database = northwind; trusted_connection = yes"; cnn.open ();
System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand (); cmd.Connection = cnn; cmd.CommandText = "Select * from PersonDetails where 1 <> 1"; System.Data.SqlClient.SqlDataReader dr = cmd.executeReader (system.data.commandbehavior.closeconnection); this.DataGrid1.datasource = Dr.getschematable (); cnn.close (); Dr.Close ();