C#下LISTBOX1的问题,在线等,帮我看看

[复制链接]
查看11 | 回复2 | 2009-4-21 09:20:08 | 显示全部楼层 |阅读模式
DbOracle db = new DbOracle();

DataSet ds = new DataSet();

if (textBox2.Text == "" & textBox1.Text == "")

{

ds = db.GetDr("selectPhone ,BeginTime from acc_Y_RecordInfo");

}

if (textBox2.Text == "" & textBox1.Text != "" )

{

ds = db.GetDr("selectPhone ,BeginTime from acc_Y_RecordInfowhere to_date(to_char(ttime,'yyyymmdd'),'yyyy-mm-dd')=to_date('" + textBox1.Text + "','yyyy-mm-dd')");

}

else if (textBox1.Text == "" & textBox2.Text != "")

{

ds = db.GetDr("select Phone ,BeginTime from acc_Y_RecordInfo whereto_date(to_char(ttime,'yyyymmdd'),'yyyy-mm-dd')=to_date('" + textBox2.Text + "','yyyy-mm-dd')");

}

else if (textBox1.Text != "" & textBox2.Text != "")

{

ds = db.GetDr("select Phone ,BeginTime from acc_Y_RecordInfo where to_date(to_char(ttime,'yyyymmdd'),'yyyy-mm-dd')>=to_date('" + textBox1.Text + "','yyyy-mm-dd') and to_date(to_char(ttime,'yyyymmdd'),'yyyy-mm-dd')<=to_date('" + textBox2.Text + "','yyyy-mm-dd')");//select语句。

}

for (int i = 0; i < ds.Tables[0].Rows.Count; i++)

{

this.listBox1.Items.Add(ds.Tables[0].Rows["Phone"].ToString());

this.listBox1.Items.Add(ds.Tables[0].Rows["BeginTime"].ToString());

}
怎么把Phone BeginTime放在一行?
在线等,先谢了

回复

使用道具 举报

千问 | 2009-4-21 09:20:08 | 显示全部楼层
for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { this.listBox1.Items.Add(ds.Tables[0].Rows["Phone"].ToString()+","+ds.Tables[0].Rows["BeginTime"].ToString()); }...
回复

使用道具 举报

千问 | 2009-4-21 09:20:08 | 显示全部楼层
换个位置写不就可以了 先ADD他 自然他就在第一行行了...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行