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

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

[复制链接]

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

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

admin 楼主

2018-8-1 14:16:36

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

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

x
8 }& J$ F% S. z2 v
' ]* d+ s7 t/ x; g
8 s* L) ]8 ?7 G; T
Technique  5 d0 |- b8 s% B3 B  s: `
Use the  Innovator.applySQL( … )  method to submit SQL direct to the database.  This
7 V  N2 U' H- B+ ^. y& A3 Lrecipe returns the XML from the  applySQL()  method and forms HTML for a table to
9 j4 g- R: a' x% D* Hdisplay the data.
- g  O7 r' U$ P( L5 i  F5 U1 |9 t7 A" N' V
* B6 {# G0 X4 h! P& v
C#  
: b, Z% }  _' s5 e: `1 mInnovator myInnovator = this.newInnovator(); 1 L8 M' h, u9 K7 Z
Item results = myInnovator.applySQL(
: K: ?" C; B! a8 `* s$ n  q  "select login_name,first_name,last_name,email " + 8 F8 S% h# {# K. |' Z, X
  "from [user] " +
2 K8 A! L: E. [. g* q  "order by last_name,first_name"); 5 S' D7 b. v- z" \& `4 F

# ~. m9 `# C' Y1 M' J) j: e% f% Qstring content = "" +
; y. p( n3 F" T2 Y  "<style type='text/css'>" +
$ p/ s7 l+ R2 I4 m( O    "table {background:#000000;}" +
, Z8 E$ D8 \4 J* s' o    "th {font:bold 10pt Verdana; background:#0000FF; color:#FFFFFF;}" + + }- c  U' ]+ K9 y' M3 ]) v
    "td {font:normal 10pt Verdana; background:#FFFFFF;}" + 0 v& j4 M: m4 H' H  `
    "caption {font:bold 14pt Verdana; text-align:left;}" + 2 a& H3 C& B* t: B# Z/ X
  "</style>" + 0 o6 l) L/ ~" _0 u- y# q; C! }  W
    "<table id='tbl' border='0' cellspacing='1' cellpadding='2' datasrc='#itemData'>" +
* w; W2 o9 h7 f$ C8 I    "<caption>User Directory</caption>" +
' y  A: E7 `5 e6 I    "<thead>" + 7 n. a$ M+ r* w) K
      "<tr>" + ; R9 z0 B: N2 `3 R: [) m. S+ `
        "<th>Login Name</th>" + " c4 i: Q3 I5 R
        "<th>First Name</th>" +
/ t' t7 J* B& U& c& }( x+ V2 l        "<th>Last Name</th>" + ( q# n* P/ o( L) x
        "<th>EMail</th>" +
) ]/ f) K2 F8 v' n/ a      "</tr>" +
/ L. L! C: V: C    "</thead>" +
6 Z- f5 D" A1 Z" I    "<tbody>";
2 j5 c5 W+ p! l6 w: u9 G1 Y# [     : l! g2 \+ H+ F: V' t9 G6 p
XmlNodeList users = results.dom.SelectNodes("//recordset/row"); 1 M( w8 \. H0 S+ c; `* g
for (int i=0; i<users.Count; i++) { / y) o4 y/ g* P$ o3 g8 N
content += "<tr><td>" + ((users.SelectSingleNode("login_name") != null) ?  
/ A# ?' \" a, u4 d                       users.SelectSingleNode("login_name").InnerText : "") + "</td>";   2 M9 X/ Q3 t4 a: p$ w2 [
   
9 J9 c" H6 R0 L! n7 K, p$ f9 N% m content += "<td>" + ((users.SelectSingleNode("first_name") != null) ? ) i6 s+ _% d# @
                       users.SelectSingleNode("first_name").InnerText : "") + "</td>";   ' `3 N; y6 q) G& X/ f8 G4 A! a0 q1 P
   
9 z, A* c, S5 Z content += "<td>" + ((users.SelectSingleNode("last_name") != null) ?
8 `  a1 s1 S9 \1 `/ n/ {                       users.SelectSingleNode("last_name").InnerText : "") + "</td>";   6 W- h: {, b$ k% q' w
         
  b+ `0 S) p1 f content += "<td>" + ((users.SelectSingleNode("email") != null) ? ) }  b/ j1 I+ W
                       users.SelectSingleNode("email").InnerText : "") + "</td></tr>";   
5 R0 r) K+ m) g$ P9 I! w7 L   
' t" X( J4 X6 z} ' M; N4 b8 y" g) `/ J
  @( p) s; p$ ?0 W3 g
content += "" +
* \: h$ t0 C3 r5 ^7 O/ e    "</tbody>" +
7 W% W0 i& b7 @+ N  "</table>"; ; [$ I- G6 O4 h4 B* Y
- C; J6 q4 b1 r3 @' @. k- y
return myInnovator.newResult(content);
7 X, P' R5 l6 r! H. N9 R+ K4 h
: Q8 m( Z5 Y: \6 a+ ~( L
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了