| 发表于:2007-10-28 10:05:06 楼主 |
private void button1_click(object sender, system.eventargs e) { ds=new dataset(); try { sda=new sqldataadapter(); sda=new sqldataadapter("select * from student",cn); sda.fill(ds,"accp"); if(ds.tables[0].rows.count!=0) { textbox1.text=ds.tables[0].rows[0][0]].tostring(); textbox2.text=ds.tables[0].rows[0][1].tostring(); textbox3.text=ds.tables[0].rows[0][2].tostring(); textbox4.text=ds.tables[0].rows[0][3].tostring(); textbox5.text=ds.tables[0].rows[0][4].tostring(); } } catch(exception ex) { messagebox.show(""+ex.message); } } 我按f5运行程序时,总是弹出一个警告框,说:“未将对象引用设置到对象的实例”; 如果按下ctrl+f5,就一切顺利 |
|
|
|
|