无法将类型为“System.Windows.Forms.BindingSource”的对象强制转换为类型“System.Data.DataTable"?
SqlDataAdapteradapter;publicDataTabledbconn(stringstrsql){adapter=newSqlDataAdapter(s...
SqlDataAdapter adapter;
public DataTable dbconn(string strsql) { adapter = new SqlDataAdapter(strsql, conn); DataTable stselect = new DataTable(); int rnt = adapter.Fill(stselect); return stselect; } int intindex = 0; public Boolean dbupdate(DataGridView dgv) { DataTable dtupdate = new DataTable(); dtupdate = this.dbconn("select* from Reports"); dtupdate.Rows.Clear(); DataTable dtshow = new DataTable(); dtshow = (DataTable)dgv.DataSource; dtupdate.ImportRow(dtshow.Rows[intindex]); 展开
public DataTable dbconn(string strsql) { adapter = new SqlDataAdapter(strsql, conn); DataTable stselect = new DataTable(); int rnt = adapter.Fill(stselect); return stselect; } int intindex = 0; public Boolean dbupdate(DataGridView dgv) { DataTable dtupdate = new DataTable(); dtupdate = this.dbconn("select* from Reports"); dtupdate.Rows.Clear(); DataTable dtshow = new DataTable(); dtshow = (DataTable)dgv.DataSource; dtupdate.ImportRow(dtshow.Rows[intindex]); 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询