PLM之家PLMHome-工业软件践行者

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

[复制链接]

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

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

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

x
* T7 ]3 M! x0 }; a1 D+ }
" P- H- y5 y9 c2 c. \
- h- i, C! c7 U+ A$ n8 f8 F
Technique  
4 a3 z3 X3 H+ p# W6 ^' dUse the  Innovator.applySQL( … )  method to submit SQL direct to the database.  This / u% m8 T& @8 i# G) I
recipe returns the XML from the  applySQL()  method and forms HTML for a table to
% b" }- C# P( bdisplay the data.
: R% C3 ?) u2 S+ z, f. v1 y3 Z: f+ V' F+ j( C' r6 H
0 @2 t: @* N/ A( _# c+ w. X& Y
C#  
# t  \' M6 S/ f9 a9 gInnovator myInnovator = this.newInnovator();
" {4 f* G, Z* y. B/ a9 z5 v$ ?Item results = myInnovator.applySQL(
* Z' i% f. }" ]: U. ~% N0 |# Q5 g  "select login_name,first_name,last_name,email " + 5 D  L- x0 a& o0 K* q* G2 z
  "from [user] " +
3 ~3 Z2 G+ J6 |5 V% o' t0 V  "order by last_name,first_name"); # k9 {. S% U: s, M+ c

) g) A9 |6 }7 A% ^' a, sstring content = "" + ; R* `$ \- [; ]9 u
  "<style type='text/css'>" +
( R' \, u' K; h- ^* e# |. L    "table {background:#000000;}" +
" B7 H) Y7 v8 d1 \' s8 I. Q2 \    "th {font:bold 10pt Verdana; background:#0000FF; color:#FFFFFF;}" +
7 N0 K# Q! b0 ?9 D    "td {font:normal 10pt Verdana; background:#FFFFFF;}" + $ N! u& W+ w# ?
    "caption {font:bold 14pt Verdana; text-align:left;}" +
0 D6 [8 x+ P1 _/ ^6 ^  "</style>" +
" O0 m& ]( p0 u% ^    "<table id='tbl' border='0' cellspacing='1' cellpadding='2' datasrc='#itemData'>" + $ {; H  p$ `& f" P1 m! S
    "<caption>User Directory</caption>" + 1 I7 k, n( N* r" l$ ~7 A. \
    "<thead>" + + R' g8 p' U5 F" A: e
      "<tr>" + & Q3 Y6 E( h, O- h
        "<th>Login Name</th>" + ! W: M7 |/ h/ Y( U. j% ^: }. v# P
        "<th>First Name</th>" +
- e! n7 @! \( O& S$ g2 F3 [9 r; k2 T        "<th>Last Name</th>" + - u& R% O9 b$ F6 M5 M' P& V4 V$ L4 P7 x
        "<th>EMail</th>" +
. ^+ r0 D. m/ _7 \      "</tr>" + * f) }/ Z( z* a
    "</thead>" +
1 \  ]' `' x/ j! }8 e& d; f6 F    "<tbody>"; 5 w3 `9 A2 y5 P4 ~4 {2 ?# Y9 C
       L0 h( ]0 x9 `7 ~0 |1 M0 z% I, ^
XmlNodeList users = results.dom.SelectNodes("//recordset/row");
/ u# t6 ]: W+ v- }! [for (int i=0; i<users.Count; i++) { $ Q. S" j9 J: Z4 `
content += "<tr><td>" + ((users.SelectSingleNode("login_name") != null) ?  3 q5 \2 y- U; ^  O1 V6 c$ Z
                       users.SelectSingleNode("login_name").InnerText : "") + "</td>";   
& k3 t8 F2 U( W. t   
2 i* G, i4 @3 K7 ^7 Q0 E$ D4 G content += "<td>" + ((users.SelectSingleNode("first_name") != null) ?
# j9 ?3 i1 D( ~/ Y3 z) u' x8 x                       users.SelectSingleNode("first_name").InnerText : "") + "</td>";   % L% C* w9 x' A0 E1 |2 F: P9 W
   ' Z5 ?% N, d2 V4 O, ?. b/ }
content += "<td>" + ((users.SelectSingleNode("last_name") != null) ?
% V5 E0 v: t# j4 Q; q                       users.SelectSingleNode("last_name").InnerText : "") + "</td>";   
7 K* {3 W9 ~6 Z. Q# D. D. M: L( N         
8 K& ]  m5 p# R: N) n content += "<td>" + ((users.SelectSingleNode("email") != null) ? $ R% @+ E7 z! v1 O( Y; J1 T2 f
                       users.SelectSingleNode("email").InnerText : "") + "</td></tr>";   , u' v& D- N7 R4 T
   
* b5 D2 c/ z5 A$ p% P7 k, A) Z} * }0 f+ l- U2 J; U

  ^* p" m1 s7 a+ rcontent += "" + / r" r) k% g) ~
    "</tbody>" +
) H  B! V7 a; c  "</table>"; . u/ t" z( p5 A8 z4 {* [: d% \5 Y

4 [1 \. N" m! Z! @1 p* ?; rreturn myInnovator.newResult(content); 9 |) Q/ F9 I* o# H1 |0 K+ J3 L7 J' W

' e8 u$ e9 Z' w6 F3 O6 }7 F
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了