标签:
internal static bool VerifyColumns(SqlConnection conn, string table, params string[] columns)
{
List<string> list = new List<string>();
using (SqlCommand sqlCommand = new SqlCommand("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS where TABLE_NAME=@Table", conn))
{
sqlCommand.Parameters.Add(new SqlParameter("Table", table));
using (SqlDataReader sqlDataReader = sqlCommand.ExecuteReader())
{
while (sqlDataReader.Read())
{
list.Add(sqlDataReader.GetString(0));
}
}
}
return columns.All(new Func<string, bool>(list.Contains));
}
return columns.All(new Func<string, bool>(list.Contains));
标签:
原文地址:http://www.cnblogs.com/shiningrise/p/5564863.html