直接上解决办法:
/// <summary>
/// 获取一个DataTable
/// </summary>
public static DataTable GetDataTable(
string connDBStr, string sql, params SqlParameter[] cmdParms)
{
SqlCommand cmd = new SqlCommand();
using (SqlConnection conn = new SqlConnection(connDBStr))
{
PrepareSqlCommand(cmd, conn, null, sql, cmdParms);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable (SetSqlAsDataTableName(sql));
da.Fill(dt);
cmd.Parameters.Clear();//多了这一句,就解决了问题
return dt;
}
}