PLM之家PLMHome-国产软件践行者

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

[复制链接]

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

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

admin 楼主

2018-8-1 14:16:36

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

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

x
9 s0 X  T3 j9 L1 X' e3 J
- \0 H! R. `% ~& @+ M% L5 Q
$ G! P; x) l8 K/ G  h; a: N
Technique  
* u8 L8 i5 o1 p7 U% a+ ?3 A2 S& uUse the  Innovator.applySQL( … )  method to submit SQL direct to the database.  This
  {, _( Y) m( M$ T: M$ L/ T7 nrecipe returns the XML from the  applySQL()  method and forms HTML for a table to , d! V: r$ X4 n. S
display the data. , V# w5 P$ r0 P# o" `0 k5 Y% H! V! W' P

; W0 i: ?: h( k. |# o8 m

8 C$ M; ^: D$ FC#  1 g2 w0 Q* u" c2 u& I% T
Innovator myInnovator = this.newInnovator(); + H0 ?( k$ _: R$ o) Z
Item results = myInnovator.applySQL(
2 E% U5 h$ d6 w4 h2 L  "select login_name,first_name,last_name,email " +
5 p% W4 e& x. |3 N7 m% ^5 a  "from [user] " +
' K9 `# g% d3 U0 Q2 A$ z  "order by last_name,first_name");
( V; K, J: O4 i, g
( y! G/ F( d% B% j$ u! S/ istring content = "" + % |% t8 U9 @$ s$ d! H, i
  "<style type='text/css'>" + . o" q9 t' I% p  R, A
    "table {background:#000000;}" +
& @( e' k% d7 |7 j* L7 v    "th {font:bold 10pt Verdana; background:#0000FF; color:#FFFFFF;}" + % I( m2 G0 n  l
    "td {font:normal 10pt Verdana; background:#FFFFFF;}" +
+ E' f* L9 t2 W8 j- z7 H/ j% {    "caption {font:bold 14pt Verdana; text-align:left;}" + ! O# I6 a- D) [; \$ ^) |
  "</style>" + 9 M: N* A$ D) u6 K9 M) ]7 @8 J+ i) ]
    "<table id='tbl' border='0' cellspacing='1' cellpadding='2' datasrc='#itemData'>" +
# @" [6 Q3 @5 X    "<caption>User Directory</caption>" +
! d% n4 u; B8 M, k, J9 r  D    "<thead>" +
1 ?% q, A% K! C  B& i* r, p7 \( V0 `      "<tr>" + " y) G* ]( O" s
        "<th>Login Name</th>" + ; d- D' W" V( t8 d. ]/ l
        "<th>First Name</th>" + , N! v: Y3 J  V. G# [- t' _
        "<th>Last Name</th>" + 2 f* Y3 ]. S; D1 q* d  |) _
        "<th>EMail</th>" +
, l+ F7 Z& V& N9 v1 K) L      "</tr>" +
5 P8 ?, h4 J! C; _    "</thead>" +
  s  ?- @& M6 _) R0 C5 g    "<tbody>";
" J8 M1 }/ Y/ \6 z' `! b/ Y     - y2 w; [/ O6 y9 W  x
XmlNodeList users = results.dom.SelectNodes("//recordset/row");
: E* s* T( W$ lfor (int i=0; i<users.Count; i++) {
* L8 c1 ^6 R' H! `2 g2 h) H$ i+ P. A content += "<tr><td>" + ((users.SelectSingleNode("login_name") != null) ?  5 a4 c: \, {4 P# l3 ^. O7 T0 [: ?
                       users.SelectSingleNode("login_name").InnerText : "") + "</td>";   
: f2 j+ ^- @& I: v   
4 m2 p- Q: T' I+ Z content += "<td>" + ((users.SelectSingleNode("first_name") != null) ?
9 r( k; G$ o; U/ ~                       users.SelectSingleNode("first_name").InnerText : "") + "</td>";   ! Y" J) g) j' W+ A! `
   8 k& K9 G5 |0 r3 _7 P* {
content += "<td>" + ((users.SelectSingleNode("last_name") != null) ?
+ Y  U+ E1 g: \6 z                       users.SelectSingleNode("last_name").InnerText : "") + "</td>";   + \  u: t0 p0 a
         ; F2 |0 s' d) `. C6 J6 P
content += "<td>" + ((users.SelectSingleNode("email") != null) ?
5 K' @7 _5 ]4 L) w3 @                       users.SelectSingleNode("email").InnerText : "") + "</td></tr>";   8 i; r2 U; P' i3 z# D- x7 c
   
- r5 U7 u" t' {1 \& ?* O}
3 m& U3 U8 T! i6 o1 t, a
4 {1 o' Y  U/ _" D0 ^3 Zcontent += "" +
3 b1 q! p& t- J3 J0 m  A    "</tbody>" + 7 ]/ S% h( @2 `. E0 V4 y, c
  "</table>"; 2 c+ |; L, ^5 F1 d) U1 U
6 L; L0 ?  r$ \, P6 R6 E8 S/ S
return myInnovator.newResult(content);
2 S& `- x) A2 }. V+ L0 [9 a
' e+ _: }" `* [( z" x$ u
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.diantuankj.com/ doTeam.tech
回复

使用道具 举报

发表回复

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

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

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

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

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

    我知道了