111,093
社区成员




public static SqlDataReader ExecuteReader(string connectionString, CommandType commandType, string commandText, params SqlParameter[] commandParameters)
{
//create & open a SqlConnection
SqlDataReader reader = null;
SqlConnection cn = new SqlConnection(connectionString);
try
{
cn.Open();
//call the private overload that takes an internally owned connection in place of the connection string
reader = ExecuteReader(cn, null, commandType, commandText, commandParameters, SqlConnectionOwnership.Internal);
}
catch
{
//if we fail to return the SqlDatReader, we need to close the connection ourselves
cn.Close();
MyDB._Check_Net = true;
}
return reader;
}