您的位置:首页 > 其它

createDataSource, and add new rows on the datagrid to be filled out.

2005-09-15 15:59 615 查看
DataTable createDataSource()
{

string strConn="server=localhost;database=LIMS;uid=sa;pwd=sa;";
string strSql = "select * from arrear where guestName = '" + id2 + "'";
SqlDataAdapter da = new SqlDataAdapter(strSql,new SqlConnection(strConn));
DataSet ds = new DataSet();
da.Fill(ds);
DataSet ds1 = ds.Clone();
dt = ds1.Tables[0];
//
int i,k=0 ;
for(i=0;i< ds.Tables[0].Rows.Count;i++)
dt.ImportRow(ds.Tables[0].Rows[i]);
Session["ItemIndex"] = (object)(i);
for(int j=(i%10);j<10;j++,k++)
{
dt.Rows.Add(dt.NewRow());
dt.Rows[i+k][3] = "null";//set the column's style
}
return dt;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐