当我从 SQLDeveloper 运行查询时,它运行良好并检索所有记录。下面的代码在部门询问时检索除一条记录之外的所有记录。是否缓存了新创建的条目不会显示的各种查询?我使用的是 Oracle DataAccess 客户端,而不是已弃用的客户端。
代码:
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
string currentDatabase = universalDll.getDB();
List<string> majors = new List<string>();
try
{
OracleConnection conn = new OracleConnection();
conn.ConnectionString = ConfigurationManager.ConnectionStrings[currentDatabase].ConnectionString;
conn.Open();
string sql =
"SELECT DISTINCT description,code " +
"FROM tablea a " +
"JOIN tableb b " +
"ON a.code = b.code ";
sql += "ORDER BY b.description";
OracleCommand executeQuery = new OracleCommand(sql, conn);
executeQuery.CommandType = CommandType.Text;
OracleDataReader dr = executeQuery.ExecuteReader();
while (dr.Read())
{
ddlChooser.Items.Add(new ListItem(dr.GetString(0) + "(" + dr.GetString(1) + ")", dr.GetString(1)));
}