当前位置: 首页 > news >正文

主从表的建立

 

//表查--病害id--主从表++++++++++++++++++++++++public static DataSet QueryGetQlgjDispdbdisidTABbyqidZC(string qid, string bwname){string SQLStringZ = "select * from   tl_qlsoft_cql_qlcheck_qlstye_bw a, tl_qlsoft_cql_qlcheck_qlstye_bw_gj b  where   a.chbwid=b.chbwid   and  a.qlid='" + qid + "' and a.chbwtypename='" + bwname + "' ";string SQLStringC = "select * from    tl_qlsoft_cql_qlcheck_qlstye_bw_gj_checkDispd  ";// and  c.chgjid='" + bwname + "'// string SQLStringC = "select * from   tl_qlsoft_cql_qlcheck_qlstye_bw a, tl_qlsoft_cql_qlcheck_qlstye_bw_gj b,tl_qlsoft_cql_qlcheck_qlstye_bw_gj_checkDispd c where   a.chbwid=b.chbwid and   b.chgjid=c.chgjid   ";// and  c.chgjid='" + bwname + "'using (SqlConnection connection = new SqlConnection(connString)){DataSet ds = new DataSet();connection.Open();//主表SqlDataAdapter commandZ = new SqlDataAdapter(SQLStringZ, connection);commandZ.Fill(ds, "dsZ");//从表SqlDataAdapter commandC = new SqlDataAdapter(SQLStringC, connection);commandC.Fill(ds, "dsC");connection.Close();//创建主外键DataColumn parent = ds.Tables["dsZ"].Columns["chgjid"];DataColumn child = ds.Tables["dsC"].Columns["chgjid"];//添加关系并指定为RelationColumnDataRelation rel = new DataRelation("RelationColumn", parent, child,false);ds.Relations.Add(rel);return ds;    //返回的是一个DataSet}

//主从表
            DataSet datdis = CqlcheckBwGjDispdSER.QueryGetQlgjDispdbdisidTABbyqidZC(cqlid, "上部结构");//QueryGetQlgjDispdbdisidTABbyqidZC
            //XRTable zz = report.FindControl("table6", false) as XRTable; //表格隐藏
            //zz.DataBindings.Add("Text", datdis, "tableCell42");
            //1.绑定主表
            DetailReportBand DetailReporttZ = report.FindControl("DetailReport", true) as DetailReportBand;
            DetailReporttZ.DataSource = datdis;
            DetailReporttZ.DataMember = "ds";


            DetailReportBand DetailReporttC = report.FindControl("DetailReport11", true) as DetailReportBand;
            //2.//指定从表成员
            DetailReporttC.DataMember = "RelationColumn";
            //3.绑定从表
            DetailReporttC.DataSource = datdis;

http://www.lryc.cn/news/10940.html

相关文章:

  • Exporter介绍与指标数据,规范说明(更新中)
  • [Android Studio] Android Studio Virtual Device虚拟机的功能试用
  • 华为OD机试 - 检查数组中是否存在满足规则的数组组合1(Python)
  • 深圳“托育”放大招!政府出钱帮你带娃啦!
  • 服务间调用方式 OpenFeign 的介绍和使用
  • 从开始测试到年薪40W,我的自动化测试艰辛历程
  • 《C++ Primer Plus》第17章:输入、输出和文件(1)
  • 静态代码审计插件 snyk 使用教程
  • 从“服务”,到“赋能”,日日顺再次定义供应链生态建设
  • MySQL(一):B+ Tree,索引以及其优点, 索引实战, 聚簇索引和非聚簇索引, 最左匹配,索引失效
  • 06:进阶篇 - Hello,CTK!
  • SpringCloud(一)注册中心
  • centos7环境配置
  • 如何解锁华为手机PIN/图案/指纹/人脸锁?
  • 物理层基本介绍
  • 数据库原理及应用期末复习汇总(附某高校期末真题试卷)
  • mummerplot gnuplot 安装(nucmer)
  • 怎样做校园外卖配送系统创业?打造一体化服务校园平台如何进行?
  • MySQL(三):切分,主从复制,读写分离
  • 王道考研——计算机网络(第一章 计算机网络体系结构)
  • ElementUI中为什么使用this.$refs.form.validate验证成功却直接跳过
  • 全期望值定理与全方差定理
  • 股票的最大利润 AcWing (JAVA)
  • Go 语言函数调用参数传递规则
  • 二分查找【零神基础精讲】
  • 「计算机组成原理」数据的表示和运算(上)
  • 分层,均质,稀薄燃烧
  • mybatis-plus小课堂:多表查询【案例篇】(apply 拼接 in SQL,来查询从表某个范围内的数据)
  • HashMap原理详解
  • 推荐3款远程办公软件