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

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

[复制链接]

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

2470

主题

1275

回帖

8万

积分

管理员

PLM之家站长

积分
82172
QQ
发表于 2018-8-1 14:16:36 | 显示全部楼层 |阅读模式

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

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

x
7 u8 M& `6 f: Z# ]( D" u
( h: o6 \6 g5 f" R& j

1 b6 a- N# w/ i1 V0 a% q1 |5 oTechnique  
0 r" y2 A( H! F4 U' qUse the  Innovator.applySQL( … )  method to submit SQL direct to the database.  This : A$ ?' S/ ?$ S" D1 X1 \2 i% Z' _
recipe returns the XML from the  applySQL()  method and forms HTML for a table to 0 g! I) p9 q# `& d1 x
display the data. - P' c4 o$ t2 O$ N( p1 v4 }

# J; U8 y8 A! a1 j
" ~: X  L/ U: s8 G0 }5 J6 x1 G
C#  9 e. e9 o1 y  O& H  E6 N
Innovator myInnovator = this.newInnovator(); 6 K* ^% L) [# D
Item results = myInnovator.applySQL( % |' I  z. L+ L3 e- j
  "select login_name,first_name,last_name,email " + & [/ w3 D) h& {' m6 @# V
  "from [user] " + 7 p& R- S' T" ]3 ?
  "order by last_name,first_name");
6 }* v3 w4 O( w4 [9 ?
8 K1 j  W; M( {( t; cstring content = "" + 7 m6 @2 n; |5 b; M: l6 ]
  "<style type='text/css'>" + - s8 ^* Y$ j" y; b% G* a
    "table {background:#000000;}" + ; I+ {1 }6 X: C) r) `# i
    "th {font:bold 10pt Verdana; background:#0000FF; color:#FFFFFF;}" + $ Z; |: b5 g! O. H
    "td {font:normal 10pt Verdana; background:#FFFFFF;}" + 9 {( D6 p- ?3 a7 {8 r" J. m- H- |
    "caption {font:bold 14pt Verdana; text-align:left;}" + ) G! n# j* }" T( c* h9 f- f$ e
  "</style>" +   w- ?7 r2 ?1 C  ?& [6 v6 k# B
    "<table id='tbl' border='0' cellspacing='1' cellpadding='2' datasrc='#itemData'>" +
7 a' C3 b  ~$ j% D: u; x    "<caption>User Directory</caption>" + $ y/ ]1 q4 t9 V5 y- L+ R; @7 l; p
    "<thead>" + . x8 S  b) T' c! }1 g; G
      "<tr>" + , Z6 P7 g# S' m& @' L6 N5 ^, J7 ^
        "<th>Login Name</th>" + 7 s0 p& f. B1 h; }  H
        "<th>First Name</th>" + - t/ o. A" M8 ]
        "<th>Last Name</th>" + 6 @& d6 I: m+ g6 n
        "<th>EMail</th>" +
8 [) }% T& M0 ~0 A- r9 ^      "</tr>" + % |2 t$ H, P9 C; N
    "</thead>" + # a) c2 w# L$ ~: V
    "<tbody>"; ; K0 D1 e7 l& X; p
     
- i; _4 Y  f+ ~' A# h6 IXmlNodeList users = results.dom.SelectNodes("//recordset/row");
! _- l2 B1 J; ^& ?, s. h, zfor (int i=0; i<users.Count; i++) { ) I% `' q( I8 J  _1 b* P7 i
content += "<tr><td>" + ((users.SelectSingleNode("login_name") != null) ?  
( L' e, y/ k: W1 S                       users.SelectSingleNode("login_name").InnerText : "") + "</td>";   
9 Y5 k; L# I8 r4 [2 `   / ]0 j3 O1 j) r7 s$ H$ [+ j
content += "<td>" + ((users.SelectSingleNode("first_name") != null) ? # {9 C* K! I- @5 u8 }9 P6 G' J
                       users.SelectSingleNode("first_name").InnerText : "") + "</td>";   % r4 w5 }. Y; J
   
% M/ y; ?+ ?* F8 V content += "<td>" + ((users.SelectSingleNode("last_name") != null) ? , n6 n. S4 Z; T+ A6 n. R) a* j
                       users.SelectSingleNode("last_name").InnerText : "") + "</td>";   5 w/ t8 R3 z- H( e
         
/ x! i" T2 l! i- i: h content += "<td>" + ((users.SelectSingleNode("email") != null) ?
5 U9 M' f2 O: ~$ g. d) w' b                       users.SelectSingleNode("email").InnerText : "") + "</td></tr>";   2 P" c  ^# ^! G5 F6 J/ T
   # F& s8 K" x% t/ C9 H
}
* e* u/ y# s0 X, l
) r4 n7 h7 e$ i. Qcontent += "" + ; {0 @' e/ l$ i2 n( p) {& n
    "</tbody>" +
/ s5 ~7 z9 x) N$ q  "</table>"; . {0 d! `% F! {2 W
6 m) z. F3 k8 B9 K6 w3 n2 R
return myInnovator.newResult(content); # S+ u( I$ B& e) y1 P

0 _# x; J, M) b
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了