PS:结合KARLI的数据库代码和网络一位兄弟的TREELIST代码,写了如下的TREELIST 与数据库绑定的代码,希望对各位有点小帮助。
private void Form1_Load(object sender, EventArgs e)
{
SqlConnection thisConn = new SqlConnection(@"server=sun;database=Northwind;user=sa;password=0810");
SqlDataAdapter thisDA = new SqlDataAdapter("SELECT CustomerID,CompanyName FROM Customers", thisConn);
SqlCommandBuilder thisCB = new SqlCommandBuilder(thisDA);
DataSet thisDS = new DataSet();
SqlDataAdapter custAD = new SqlDataAdapter("SELECT * FROM Customers", thisConn);
custAD.Fill(thisDS, "Customers");
SqlDataAdapter orderAD = new SqlDataAdapter("SELECT * FROM Orders", thisConn);
orderAD.Fill(thisDS, "Orders");
DataRelation custOrderRel = thisDS.Relations.Ad