PLM之家PLMHome-工业软件与AI结合践行者

【Aras二次开发源码】使用ApplySQL进行快速查询

[复制链接]

2018-8-1 14:16:36 3156 0

admin 发表于 2018-8-1 14:16:36 |阅读模式

admin 楼主

2018-8-1 14:16:36

请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!

您需要 登录 才可以下载或查看,没有账号?注册

x
! n8 W  r$ S. z) A3 Z' q* a
7 W, @& C) w" X4 R5 b
* O. J- t  M6 w0 l& Z+ I
Technique  + w! W3 _; ]& v; O4 W7 W6 w
Use the  Innovator.applySQL( … )  method to submit SQL direct to the database.  This 7 s$ B  f, G1 J
recipe returns the XML from the  applySQL()  method and forms HTML for a table to ; X9 R9 V8 N% ^/ F+ k& C2 l# b) ?
display the data. % {& G9 z3 ?0 x

2 b( s6 l4 y+ h: m8 G3 v+ b9 b
# E) f! O3 g  o. t& `
C#  5 n9 L* Q! O( e: i: l, e
Innovator myInnovator = this.newInnovator(); # C! A  m& G& j$ Z* T: d* R7 T, m
Item results = myInnovator.applySQL(
) c: M8 [$ H5 K5 _8 d" M% S  "select login_name,first_name,last_name,email " +
7 w! g. [4 ]9 e$ R  "from [user] " +
, f3 h3 @# K) b: w% D9 Q' @6 F* ?  "order by last_name,first_name");
% I/ A# J2 |9 K" |; @
! }) u9 U# r8 ?& ]0 N" T3 sstring content = "" +
" T: m" U: V& D  "<style type='text/css'>" +
7 i( k% A) O$ a$ }6 e    "table {background:#000000;}" + / N# [, |! @5 ?9 r- |1 Z2 E
    "th {font:bold 10pt Verdana; background:#0000FF; color:#FFFFFF;}" + , [- n- A) k& Q. C) ^
    "td {font:normal 10pt Verdana; background:#FFFFFF;}" +
1 |3 m" q" `' q  ]$ h    "caption {font:bold 14pt Verdana; text-align:left;}" +
6 _& e7 A1 `; i7 }: @0 |0 i& B  "</style>" + % F* U% q! ^% S7 D  I
    "<table id='tbl' border='0' cellspacing='1' cellpadding='2' datasrc='#itemData'>" +
# n1 D5 }4 L& \/ V" ]+ T% B5 ~8 P0 B    "<caption>User Directory</caption>" + 6 O# c# G& P- x$ k
    "<thead>" +
5 }: M/ V% w9 p      "<tr>" +
9 \5 @9 p! P; o- l/ ~: I" a% F" H" K        "<th>Login Name</th>" +
  U) |4 m; c; K/ _5 a; W. }5 w+ G        "<th>First Name</th>" +
* D- x% i. P9 L: w        "<th>Last Name</th>" +
+ C. V8 J4 K2 W4 B$ G        "<th>EMail</th>" + 8 j* j9 O% s! f6 r- Z5 [( R) K
      "</tr>" +
# T& |. A* V1 O1 |+ C/ ^* J    "</thead>" +
: c. C; ^6 W. R$ L8 D/ E8 @! h  w    "<tbody>"; * x! V4 @( }) L, y% {& _
     5 S( j  y7 ~2 I" a; F& P: @
XmlNodeList users = results.dom.SelectNodes("//recordset/row"); 1 J  c  Z# k& G/ O
for (int i=0; i<users.Count; i++) { 4 H! E0 l! u) m- _( w% T
content += "<tr><td>" + ((users.SelectSingleNode("login_name") != null) ?  1 P0 J) I9 M  W2 L
                       users.SelectSingleNode("login_name").InnerText : "") + "</td>";   
' A, O& B+ ?# v7 _) c   7 O0 O7 z1 G; v0 M& [& M
content += "<td>" + ((users.SelectSingleNode("first_name") != null) ?
' R" h" i: V& f                       users.SelectSingleNode("first_name").InnerText : "") + "</td>";   9 f, v$ f; \/ Y( B$ E! j( `
   8 i( y+ f" S) r2 J1 ]
content += "<td>" + ((users.SelectSingleNode("last_name") != null) ? 8 \+ V, ^. F0 D9 u( A; S
                       users.SelectSingleNode("last_name").InnerText : "") + "</td>";   
) J" Z0 |) G* g- c; Q         % `: M0 M5 u! `8 P% P
content += "<td>" + ((users.SelectSingleNode("email") != null) ? # U" o0 \9 \- y+ V
                       users.SelectSingleNode("email").InnerText : "") + "</td></tr>";   + F+ f  [0 f: {# o* O5 y
   7 `' ~3 u/ W/ x
} ( c3 y  p( u: A: z1 X+ r2 ^
: n1 y: V& y) f4 M) `
content += "" +
1 k+ G/ U* @3 p    "</tbody>" + . `4 d" Z- u7 Y( H
  "</table>"; 9 L* Y# i& l. i8 E( h! s. I

! |7 w- V( H. ureturn myInnovator.newResult(content);
5 u4 ~( j( N2 M0 O8 ?; l; f7 w( W% o
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 注册

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

    本网站(plmhome.com)为PLM之家工业软件学习官网站

    展示的视频材料全部免费,需要高清和特殊技术支持请联系 QQ: 939801026

    PLM之家NX CAM二次开发专题模块培训报名开始啦

    我知道了