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 ();