【 tulaoshi.com - ASP.NET 】
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();