评论会员:sriman.ch 时间:2012/02/07
喜桑特
试试下面的
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings[urconnectionstring].ConnectionString.ToString());
SqlCommand sqlCom = new SqlCommand(urQuery);
sqlCom.CommandType = CommandType.Text;
SqlDataAdapter da = new SqlDataAdapter(sqlCom.CommandText, con);
DataSet dsEmp = new DataSet();
da.Fill(dsEmp);
if (dsEmp.Tables.Count > 0)
{
if (dsEmp.Tables[0] != null && dsEmp.Tables[0].Rows.Count>0)
{
dsEmp.Tables[0].Rows.InsertAt(dsEmp.Tables[0].NewRow(), 0);
}
}
GridView1.DataSource = dsEmp.Tables[0];
GridView1.DataBind();
希望这有助于
评论会员:sriman.ch 时间:2012/02/07
嗨,
有称为InsertAt属性,这将在指定的位置插入的DataRow。但要确保,poistion内最大的行数
的限制
例如:
{C}
希望这会有所帮助:代码89
评论会员:游客 时间:2012/02/07
尝试codepreds.Tables[spanclass="code-digit"0/span].Rows.InsertAt(ds.Tables[spanclass="code-digit"0/span].NewRow(),spanclass="code-digit"0/span);/pre/codeimgsrc=