我在1个数据库中有2个表
TABLE 1: LOGS
TABLE 2: MASTER LIST
LOGS
HOST | USER | NAME
==================
1 | A | A1
1 | A | B1
1 | A | C1
1 | A | D1
MASTER LIST
HOST | USER | NAME
===================
1 | A | A1
1 | A | B1
1 | A | C1
在我的C#程序中,我有一个gridview,我需要突出显示未包含在主列表中的行
LOGS
HOST | USER | NAME
==================
1 | A | A1
1 | A | B1
1 | A | C1
**1 | A | D1**
这是我的C#代码:
//Create the OracleCommand
OracleCommand OCom = new OracleCommand("SERVERSTATUS.LOG_LIST", oc);
OCom.CommandType = CommandType.StoredProcedure;
OCom.Parameters.Add("out_RESULT", OracleType.Cursor).Direction = ParameterDirection.Output;
OCom.Parameters[0].Value = sid;
OracleDataAdapter _daGrid1 = new OracleDataAdapter(OCom);
_daGrid1.Fill(_dsGrid);
_daGrid1.Dispose();
_daGrid1 = null;
OCom.Dispose();
OCom = null;
if (frm_IT010_03 == null)
{
//button click show form with gridview
frm_IT010_03 = new IT010_03(_dsGrid);
frm_IT010_03.ShowDialog();
}
Class LogArray:此类将数据从数据库存储到数组..如何调用该类?所以我可以将它与网格进行比较..
public void LogArray(ArrayList al)
{
OracleConnection oc = new OracleConnection(ConOra);
DataSet _dsGrid = new DataSet();
try
{
oc.Open();
}
catch (OracleException ex)
{
MessageBox.Show(ex.ToString());
}
try
{
OracleCommand OCom = new OracleCommand("SERVERSTATUS.LOG_STATUS", oc);
OCom.CommandType = CommandType.StoredProcedure;
OCom.Parameters.Add("out_RESULT", OracleType.Cursor).Direction = ParameterDirection.Output;
OracleDataReader DataReader = OCom.ExecuteReader();
while (DataReader.Read())
{
al.Add(DataReader.GetString(0));
}
}
catch
{
...
}
我已经在Oracle中编译了一个包含2个过程的包
Package name: Server Status
Procedure name: **Log_list** = Calls for the Logs Table
Procedure name: **Log_status** = Calls for the values that are in the logs table but is not included in the master list table.
谢谢! =))
答案 0 :(得分:0)
我不确定我是否理解你,但如果您只需要知道要突出显示哪些记录,那么您可以在sql(或plsql)中使用它。
您的查询可能是这样的:
select l.HOST, l.USER, l.NAME, case when ml.HOST is null then 1 else 0 end is_to_highlight
from LOGS l left outer join MASTER_LIST ml on l.HOST = ml.HOST
and l.USER= ml.USER
and l.NAME = ml.NAME