请教个DataRelation的问题
我在DataSet中设置了主表和从表的关系
能正常显示
现在在此基础上加了个搜索的功能,现在搜索主表中一行的数据出来
并也把相关的关系数据显示出来。
能正常显示
现在在此基础上加了个搜索的功能,现在搜索主表中一行的数据出来
并也把相关的关系数据显示出来。
string conStr="***";
SqlConnection cn=new SqlConnection(conStr);
SqlCommand cmd=new SqlCommand("select * from Table where 店舗CD=1",cn);// 加条件就有问题 查了些资料说不能进行相关搜索 但想问问高手又没有解决办法。
//cmd.CommandType=CommandType.StoredProcedure;
SqlDataAdapter da=new SqlDataAdapter(cmd);
DataSet ds=new DataSet();
da.Fill(ds,"Header");
da=new SqlDataAdapter("select * from ResultDetail",cn);
da.Fill(ds,"Detail");
DataRelation drl=new DataRelation("Head_Detail",ds.Tables["Header"].Columns["店舗CD"],ds.Tables["Detail"].Columns["storeCD"],true);
ds.Relations.Add(drl);
cn.Close();
cmd.Dispose();
da.Dispose();
...全文
相关推荐
使用DataAdapter填充多个表(利用DataRelation)的实例代码
使用DataAdapter填充多个表(利用DataRelation)的实例代码,需要的朋友可以参考一下
C# 自定义DataSet
C# 自定义DataSet qq:292258449
基于.NET的Web应用程序设计.doc
基于.NET的Web应用程序设计.doc
自测试卷2.doc13.DataReader对象与DataSet对象有何区别? 14.线程在C#中使用什么类表示,你在什么情况下会考虑程序中使用线程?
5.如果要将一个方法定义为无返回值类型的方法,则需要使用什么关键字? 6.下列代码中x的输出结果是___________。 private int Add(ref int x, int y) { x = x + y; return x; } static void Main(string[] args) { Program pro = new Program(); int x = 30; int y = 40; Console.WriteLine(pro.Add(ref x, y)); Console.WriteLine(x); } 7.接口和抽象类的区别是什么? 8. System.String 和System.StringBuilder有什么区别?
微软认证题库之web
如果你学的是用基于vs03开发或SQL2000的话再看吧哎,有点落伍,但是不一定哦不是说学越基层的越能学到很多知识吗不过这个……题库嘛还是对症下药吧~~~


