日期:2014-05-18 浏览次数:20866 次
using( System.Data.SqlClient.SqlConnection sqlConn = new System.Data.SqlClient.SqlConnection( "Data Source=.;Initial Catalog=NorthWind;Integrated Security=True" ) ) { System.Data.SqlClient.SqlCommand sqlCmd = new System.Data.SqlClient.SqlCommand( "SELECT * FROM Orders " , sqlConn ); System.Data.SqlClient.SqlDataAdapter sqlDapter = new System.Data.SqlClient.SqlDataAdapter( sqlCmd ); DataSet ds = new DataSet( ); sqlDapter.Fill( ds ); Response.Write( "Orders 表是否存在列名OrderDate:" + ds.Tables[0].Columns.Contains( "OrderDate" ) ); Response.Write("<br />"); Response.Write( "Orders 表是否存在列名OrderDates1:" + ds.Tables[0].Columns.Contains( "OrderDates" ) ); }