日期:2014-05-18 浏览次数:20850 次
string mysql = "select * from carinfo"; m_dataadapter = new SqlDataAdapter(mysql, m_connection); m_dataadapter.FillSchema(m_ds, SchemaType.Source, "carinfo"); m_dataadapter.Fill(m_ds, "carinfo"); mysql = "select * from cardinfo"; m_dataadapter2 = new SqlDataAdapter(mysql, m_connection); m_dataadapter2.FillSchema(m_ds, SchemaType.Source, "cardinfo"); m_dataadapter2.Fill(m_ds, "cardinfo"); mysql = "select * from userinfo"; m_dataadapter3 = new SqlDataAdapter(mysql, m_connection); m_dataadapter3.FillSchema(m_ds, SchemaType.Source, "userinfo"); m_dataadapter3.Fill(m_ds, "userinfo");
string mysql="select * from cardinfo inner join carinfo on cardinfo.ID=carinfo.ID inner join userinfo on cardinfo.userID=userinfo.userID"; m_dataadapter = new SqlDataAdapter(mysql, m_connection); m_dataadapter.FillSchema(m_ds, SchemaType.Source, "carinfo"); m_dataadapter.Fill(m_ds, "carinfo");
------解决方案--------------------
建议用 DataSetHelper ,里面支持对DataTable的 join,group ..
------解决方案--------------------
自己在DataSet中新增加一张表,然后通过Ado.net表达式实现,这样不需要管理数据同步,应该是比较好的一种解决方式,
http://www.microsoft.com/china/MSDN/library/data/dataAccess/ADONETEXP.mspx