如何在DATAGRID中插入一个新行,并在DATAGRID的第一行显示出来 修改DataTable表添加一个DataRow到DataTable表的第一行,再绑定 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 好象不行,我用insertAt(oRow,0)加到首行,但是它还在最后出现,就象有add(oRow)一个样 可以先在DataTable中插入一行,在将DataTable绑定到datagrid中 我的代码,你大概看一下print ds = new print();this.sqlConnection1.Open();string strSel = "Select * from s_basic where s_id="+chk_s_id;SqlDataAdapter MyAdapter = new SqlDataAdapter(strSel,sqlConnection1);MyAdapter.Fill(ds,"s_basic");//s_family填充空行MyAdapter.SelectCommand.CommandText="Select * from s_family where s_id="+chk_s_id;MyAdapter.Fill(ds,"s_family");this.sqlCommand1.CommandText = "Select count(*) as iCount from dbo.s_family where s_id="+chk_s_id;this.sqlCommand1.Connection =this.sqlConnection1 ;SqlDataReader reg=this.sqlCommand1.ExecuteReader();reg.Read ();int Count=Convert.ToInt32(reg["iCount"]);reg.Close ();DataRow newRow;for(int i=0;i<(6-Count);i++){newRow=ds.Tables["s_family"].NewRow();newRow["s_ID"]=chk_s_id;ds.Tables["s_family"].Rows.Add(newRow);}MyAdapter.SelectCommand.CommandText="Select * from s_change where s_id="+chk_s_id;MyAdapter.Fill(ds,"s_change"); 在ROWS对象下,好象没有AddAt(oRow,0)这个方法,是不是写错了? to netwalking(不懂就问) 你的做法也是加到最后呀,我不想重构一个DS,有没有更好的方法? 在DataTable中添加一列,作为索引。 有办法让ListBox实现多选绑定吗? XML 数据绑定 数据库间数据的问题? 紧急求救!ASP.NET网站的配置问题,我急死了啊!!! 为什么不能运行? 一个旅游大巴座位排位选择的问题,该模块类似电影院座位,可随机选择,可指定(前提该位置为被出售或预订) 打印机无效 在asp.net中怎么实现报表中一列中相同数据压缩的功能(详细请讲) 如何捕捉动态控件的事件 请问如何在ASP+ 里面调用我的dll? 动态事件处理?? 如何给dropdownlist绑定一串数字
print ds = new print();
this.sqlConnection1.Open();
string strSel = "Select * from s_basic where s_id="+chk_s_id;
SqlDataAdapter MyAdapter = new SqlDataAdapter(strSel,sqlConnection1);
MyAdapter.Fill(ds,"s_basic");
//s_family填充空行
MyAdapter.SelectCommand.CommandText="Select * from s_family where s_id="+chk_s_id;
MyAdapter.Fill(ds,"s_family");this.sqlCommand1.CommandText = "Select count(*) as iCount from dbo.s_family where s_id="+chk_s_id;
this.sqlCommand1.Connection =this.sqlConnection1 ;
SqlDataReader reg=this.sqlCommand1.ExecuteReader();
reg.Read ();
int Count=Convert.ToInt32(reg["iCount"]);
reg.Close ();
DataRow newRow;
for(int i=0;i<(6-Count);i++)
{
newRow=ds.Tables["s_family"].NewRow();
newRow["s_ID"]=chk_s_id;
ds.Tables["s_family"].Rows.Add(newRow);
}MyAdapter.SelectCommand.CommandText="Select * from s_change where s_id="+chk_s_id;
MyAdapter.Fill(ds,"s_change");
你的做法也是加到最后呀,我不想重构一个DS,有没有更好的方法?