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

来源:百度知道 编辑:UC知道 时间:2024/06/21 11:47:47
DbOracle db = new DbOracle();
DataSet ds = new DataSet();
if (textBox2.Text == "" & textBox1.Text == "")
{
ds = db.GetDr("select Phone ,BeginTime from acc_Y_RecordInfo");
}
if (textBox2.Text == "" & textBox1.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')");

}
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('" + textBox2.Text + "','yyyy-mm-dd')&q

for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
this.listBox1.Items.Add(ds.Tables[0].Rows[i]["Phone"].ToString()+","+ds.Tables[0].Rows[i]["BeginTime"].ToString());

}

换个位置写不就可以了 先ADD他 自然他就在第一行行了