C# 中有关数据库中数据的操作中,能否自连接
来源:互联网 发布:js防水涂料 执行标准 编辑:程序博客网 时间:2024/06/04 18:07
#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-------从数据库中得到候选一项集---------
上述程序能不能实现呢?
有没有高人给我点建议啊
- C# 中有关数据库中数据的操作中,能否自连接
- C#中有关数据库的数据转换
- C#学习中记录(二)--------数据库的连接操作
- C#中数据库操作
- C#中操作数据库
- C#中操作数据库
- c#中数据库操作
- PostgreSQL中删除的数据能否恢复
- PostgreSQL中删除的数据能否恢复
- C# VS2010中,用微软自带的System.Data.OracleClient来连接Oracle数据库
- C# VS2010中,用微软自带的System.Data.OracleClient来连接Oracle数据库
- C# VS2010中,用微软自带的System.Data.OracleClient来连接Oracle数据库 .
- C# VS2013中,用微软自带的System.Data.OracleClient来连接Oracle数据库
- C# VS2010中,用微软自带的System.Data.OracleClient来连接Oracle数据库
- C# VS2005中,用微软自带的System.Data.OracleClient来连接Oracle数据库
- C#中comboBox和数据库的连接
- C#中连接SQL数据库的测试
- C#中oracle数据库的连接方法
- A new SDK function: ReplaceFile
- 爱情,留给懂得爱自己的人!
- Wine里的中文程序出现方块字的解决方法以及Wine快捷方式的命令格式
- 将二进制转为字符串,再还原的方法
- 画笔对象,画刷对象
- C# 中有关数据库中数据的操作中,能否自连接
- 从SOA到ESB,再到JBI
- javascript的prototype继承
- JBI-Java 实现 SOA 的标准途径
- ASP函数大全
- 将Hotmail转发到Gmail的方法(成功设置)
- JBI学习笔记
- Spring整合Hibernate抛出Could not initialize class net.sf.cglib.proxy.Enhancer解决方法
- Windows 2000下的Raw Socket编程