#region-------从数据库中得到候选一项集---------
///
/// 从数据库中得到候选一项集
///
static ArrayList GetItems1FromDB()
{
string commandString = "select * from View_sales98";
//string commandStringT = "select time_id from View_sales98";
//string commandStringS = "select 商品_ID from View_sales98";
DataSet ds = ExcuteDataSetByCommandString(commandString);
//DataSet dsT = ExcuteDataSetByCommandString(commandStringT);
// DataSet dsS = ExcuteDataSetByCommandString(commandStringS);
客户-id | time-id | 商品id |
1 | 1 | 34 |
1 | 1 | 45 |
2 | 2 | 56 |
2 | 4 | 67 |
我想用一个二维数组a[客户列][商品列]来表示。
#region-------从数据库中得到候选一项集---------
///
/// 从数据库中得到候选一项集
///
static ArrayList GetItems1FromDB()
{
string commandString = "select * from View_sales98";
//string commandStringT = "select time_id from View_sales98";
//string commandStringS = "select 商品_ID from View_sales98";
DataSet ds = ExcuteDataSetByCommandString(commandString);
//DataSet dsT = ExcuteDataSetByCommandString(commandStringT);
// DataSet dsS = ExcuteDataSetByCommandString(commandStringS);
int countItems1 = 0;
countItems1 = ds.Tables[0].Rows.Count;
ArrayList Items1 = new ArrayList();
for (int i = 0; i < countItems1; i++)
{
string kehui = ds.Tables[0].Rows[i]["客户_ID"].ToString();
string timei = ds.Tables[0].Rows[i]["time_id"].ToString();
for (int j = 1; j < countItems1&&i!=j; j++)
{
string kehuj = ds.Tables[0].Rows[j]["客户_ID"].ToString();
string timej = ds.Tables[0].Rows[j]["time_id"].ToString();
if (kehui == kehuj && timei == timej)
{
Items1.Add(ds.Tables[0].Rows[i]["商品_ID"].ToString());
}
}
}
return Items1;
}
#endregion-------从数据库中得到候选一项集---------
上述程序能不能实现呢?
有没有高人给我点建议啊