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

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

[复制链接]

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

2470

主题

1275

回帖

8万

积分

管理员

PLM之家站长

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

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

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

x

# |( @6 Q3 A- c1 U* ~  y/ O- D  L: L$ V$ x% g2 Q& U5 u
! j5 v& q1 Q# c2 k, k+ ~; w' r
Technique  / b# s6 N% X& |0 H- O# L
Use the  Innovator.applySQL( … )  method to submit SQL direct to the database.  This
( v* |- P3 x* W( jrecipe returns the XML from the  applySQL()  method and forms HTML for a table to & U" i4 b- W3 o2 l' M1 f  w
display the data.
, `/ S7 o  H; Q9 N/ ?
& l9 P7 r  t# f4 `) P, s  K$ G
$ U3 j1 S. l4 k2 ?$ y5 e8 Y
C#  
+ f  n' L* i% _0 z) HInnovator myInnovator = this.newInnovator(); " ^( ?$ y6 N0 ]: U: y' R
Item results = myInnovator.applySQL( 8 K2 a4 s7 g/ U- D
  "select login_name,first_name,last_name,email " +   H! |6 s# |6 k, U1 r, X- F  s
  "from [user] " +
# A& n- \& Y8 \1 p7 P% w  "order by last_name,first_name");
7 Z  c& ~: D1 s% U + ~) E8 b7 k: T; S
string content = "" +
" r& ?: w" I. P& L  "<style type='text/css'>" + 1 Q) }( ?: W) u7 P# _
    "table {background:#000000;}" +   x8 {4 P1 n: P8 m* B
    "th {font:bold 10pt Verdana; background:#0000FF; color:#FFFFFF;}" + * L0 |' l3 G! ]
    "td {font:normal 10pt Verdana; background:#FFFFFF;}" +
, B* K$ I' F$ C, k7 I    "caption {font:bold 14pt Verdana; text-align:left;}" +
8 S5 F% z5 }( h  "</style>" + + J5 `; u3 E5 ]! S: u. ^
    "<table id='tbl' border='0' cellspacing='1' cellpadding='2' datasrc='#itemData'>" + # D3 x$ `# D5 N9 p3 f
    "<caption>User Directory</caption>" + 0 {) p; E- [/ K
    "<thead>" + # T( `# Y1 g( j
      "<tr>" + ( ]: C* c+ n5 @% R& |) j& d
        "<th>Login Name</th>" +
, O( P: P! K4 E" p  A* a        "<th>First Name</th>" + / Q* \7 f( w2 b/ |5 v
        "<th>Last Name</th>" +   `+ ?. C) D; I+ Z, C5 r. e. Z8 C
        "<th>EMail</th>" + . j  d1 N& Z* \8 X. {" M1 z. U
      "</tr>" +
, ]  r$ W( |( q- \, [    "</thead>" + 9 {2 u1 c$ w. P# d0 A
    "<tbody>"; $ x1 b. b3 C! h8 X4 A) F
     $ D3 l3 N8 Q% ]7 H! T; P; ?
XmlNodeList users = results.dom.SelectNodes("//recordset/row");
. f' q# N! n) r/ Q( q2 z8 v! w. R* ^0 Jfor (int i=0; i<users.Count; i++) {
& Z4 W* T+ D8 S4 Y* x content += "<tr><td>" + ((users.SelectSingleNode("login_name") != null) ?  
. ?, a" L* m+ Z0 s$ G. e. _                       users.SelectSingleNode("login_name").InnerText : "") + "</td>";     ]) l* Q4 J  `4 a& z: Q2 n' P
   ( X  J1 B4 h4 w( C2 E# v4 k
content += "<td>" + ((users.SelectSingleNode("first_name") != null) ? & K3 w* E6 s. R$ {- p0 n: y* P
                       users.SelectSingleNode("first_name").InnerText : "") + "</td>";   
  Y, r% r3 C& u/ S1 U/ _# v   + [. M; d/ ~% b1 ~# P* a+ C
content += "<td>" + ((users.SelectSingleNode("last_name") != null) ? & q2 s) b& r9 G/ t0 n3 O$ S
                       users.SelectSingleNode("last_name").InnerText : "") + "</td>";   
: ?6 \. O% G7 W" i* w5 F% l1 w* k         4 W2 m* h. X/ T2 C2 r" F9 ^+ T$ F
content += "<td>" + ((users.SelectSingleNode("email") != null) ?
2 E/ L! }2 ]2 N5 i. B                       users.SelectSingleNode("email").InnerText : "") + "</td></tr>";   + M, Q& u5 j$ q; n* E
   
5 q1 s3 {+ E0 y3 h6 `3 }0 ]. N$ M} $ s3 g* U+ M. N* f. [, b
$ f# j! n. m  Z+ N) D
content += "" +
8 X/ [& [( }/ }( A( s9 p    "</tbody>" + ! F& g, O) r9 b, U' E
  "</table>";
5 Q: L3 i/ L+ j8 _" j + H8 \! P6 p) r, A5 F
return myInnovator.newResult(content);
/ r2 ~8 g2 M' Y3 V/ \# I% p) J5 Y$ i$ M) n/ o, i* ^
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了