日期:2014-05-17 浏览次数:21023 次
private void IniData()
{
string conn=@"Data Source=.\sql;Initial Catalog=AdminManagement;User ID=sa;Pwd=123";
SqlConnection con=new SqlConnection();
con.ConnectionString=conn;
con.Open();
string sql="select * from Event where EventID=EventSortID";
string sql2 ="select * from Event where EventSortID!=EventID";
SqlDataAdapter da = new SqlDataAdapter(sql, con);
SqlDataAdapter da2 = new SqlDataAdapter(sql2, con);
DataSet ds = new DataSet();
da.Fill(ds, "sort");
da2.Fill(ds, "event");
DataRelation dr = new DataRelation("子权限", ds.Tables["sort"].Columns["EventID"], ds.Tables["event"].Columns["EventSortID"]);
ds.Relations.Add(dr);
gridControl1.DataSource=ds.Tables[0];
}