請問高手們,DataSet中已經有好幾張表,現在是我想通過sql語句,操作這些表,生成一個新的表,再把這個表加入到DataSet中.請問,哪些給我舉個sql語句對DataSet中的表進行select update delete insert操作的!

解决方案 »

  1.   

    参见MSDN:select 参见:DataTable.Select();其他,参见:SqlDataAdapter.Update()
      

  2.   

    In a DataSet with multiple DataTable objects, you can use DataRelation objects to relate one table to another, to navigate through the tables, and to return child or parent rows from a related table.
    customerOrders.Relations.Add("CustOrders",
      customerOrders.Tables["Customers"].Columns["CustID"],
      customerOrders.Tables["Orders"].Columns["CustID"]);
      

  3.   

    我觉得DataTable.select方法只能取出一部分数据.不能达到LZ的要求.
    通过relation从理论上也能实现,不过很复杂(拼表).
    最后的方法就是不从Dataset上想办法,而是重新从数据库里取一次,用你的复杂的多表查询的SQL语句.