|
From1 listview空间,查询按钮button,点击查询button跳转到From2.From2连接数据库查询数据,查询的结果返回到From1的listview。问题是我现在From1 listview什么值都没有得到。本人小白,所以各位最好详情点,谢谢。
AseDataReader reader = null;
Myplayer myplayer =new Myplayer();
AseConnection conn = new AseConnection("Data Source='192.168.7.88'ort='5000';UID='sa'WD='';Database='GZMCH'; MaxPoolSize = 10;MinPoolSize = 5;ConnectionTimeout = 15;");
try
{
conn.Open();
// String sqlstr = "select phone,filename from call_phone_takelog_ago where logtime>" + starttime + " and logtime<" + endtime + "";
String sqlstr = "exec sp_lylisten";
AseCommand cmd = new AseCommand(sqlstr, conn);
reader = cmd.ExecuteReader();
while (reader.Read())
{
ListViewItem lv = new ListViewItem();
lv.SubItems.Clear();
lv.SubItems.Add(Convert.ToString(reader["rowid"]));
lv.SubItems.Add(Convert.ToString(reader["phone"]));
lv.SubItems.Add(Convert.ToString(reader["filename"]));
myplayer.listView1.Items.Add(lv);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
this.Hide();
reader.Close();
conn.Close();
}
|
|