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放在一行?
在线等,先谢了
|