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

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

[复制链接]

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

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

admin 楼主

2018-8-1 14:16:36

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

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

x
- a6 p( V9 N' b. J* V' M& q

6 h; k7 b. f) B# _
4 F6 Z0 }! V# n! C2 BTechnique  
5 Z, y: C3 ]4 m( }) kUse the  Innovator.applySQL( … )  method to submit SQL direct to the database.  This
6 d, C' {8 v' J" k5 i. O* M! |recipe returns the XML from the  applySQL()  method and forms HTML for a table to 6 r9 p& X3 Y; l- q2 H) P+ I
display the data. ( w6 j* l+ n# r1 P  _. D

2 _! E! ^; c5 S
8 ~# O; T( l% c/ x; ~
C#  
3 a; t( M7 N1 \9 pInnovator myInnovator = this.newInnovator(); * N+ g9 }$ j" C# S( l
Item results = myInnovator.applySQL(
8 N" c( E7 j9 C. ^2 r" ]) l  "select login_name,first_name,last_name,email " + # w$ I) s, `3 T0 S1 X' M4 z
  "from [user] " +
! A) D/ {- v  r0 }9 l  m# _  "order by last_name,first_name"); ( I- I# K. T- h0 D1 F. P8 R) e
% N2 J6 ?+ p! \8 F
string content = "" +
( |% ]2 U9 I  e$ C4 }% e  "<style type='text/css'>" +
+ v9 R. x' M: u3 z, x    "table {background:#000000;}" + 5 A+ m6 T7 Z, A" }" x( }; }& b
    "th {font:bold 10pt Verdana; background:#0000FF; color:#FFFFFF;}" + 3 g6 b/ D0 ?4 ~& C
    "td {font:normal 10pt Verdana; background:#FFFFFF;}" + . c$ D9 x6 l4 ]) `' I8 }
    "caption {font:bold 14pt Verdana; text-align:left;}" + 5 C, A& k) Q/ M$ p5 W+ {" m- j. Y' \6 }- z( D
  "</style>" +
2 c) s1 ^3 J, ~: G% T7 f    "<table id='tbl' border='0' cellspacing='1' cellpadding='2' datasrc='#itemData'>" +
0 \: V/ d, `( w. D+ m: H    "<caption>User Directory</caption>" +
% g& B! |! \0 T* a6 ~    "<thead>" + 4 W$ h, I% W9 `9 }  P! }
      "<tr>" +
- V" p6 L0 b9 a6 Q( X- V/ z/ d, f        "<th>Login Name</th>" + ( ^0 ]0 V5 R! C/ S& W6 u0 [* Z
        "<th>First Name</th>" + ( q" U: F# t& u3 e
        "<th>Last Name</th>" +
4 f7 a1 P' h$ G9 ?        "<th>EMail</th>" + # \$ E; E6 A; y8 x
      "</tr>" +
3 z# a9 m- K2 K" P: H  i    "</thead>" +
. V. f" `% o+ ?% M5 c) B    "<tbody>"; 4 E1 j; U  i) r/ F
     
0 {: J: z4 D  P: p& QXmlNodeList users = results.dom.SelectNodes("//recordset/row");
; _) N" l/ W- D+ Gfor (int i=0; i<users.Count; i++) {
6 s3 U% m9 S& Z2 x! X content += "<tr><td>" + ((users.SelectSingleNode("login_name") != null) ?  
$ s! p4 [& `+ l8 R                       users.SelectSingleNode("login_name").InnerText : "") + "</td>";   $ e* y* k6 X, b' p2 {) f  V4 x
   
, s9 H( j4 n$ ^% \) B, m5 h& V6 i content += "<td>" + ((users.SelectSingleNode("first_name") != null) ?
6 u4 q' O4 e) }: ]1 V+ F# j) g                       users.SelectSingleNode("first_name").InnerText : "") + "</td>";   
; q  ^: m4 }% c! ~& a   2 |1 w. _1 @5 N5 k# p/ `+ j
content += "<td>" + ((users.SelectSingleNode("last_name") != null) ?
0 ~" c' Z" e! H0 u! S7 _. _6 x& w                       users.SelectSingleNode("last_name").InnerText : "") + "</td>";   * V; _  {  A+ e) x( O4 v! B$ e
         
! f1 N0 f- D0 a% q8 K* k content += "<td>" + ((users.SelectSingleNode("email") != null) ?
) y  S; v8 I) f$ |6 s3 ?# b                       users.SelectSingleNode("email").InnerText : "") + "</td></tr>";   & b9 }% [9 A% C& R3 s: V
   2 w6 }9 w" `/ D4 a6 b
}
8 K# @7 X0 C" k" n1 I % C' ~6 D) D2 v) m1 P' r  X
content += "" +
5 W, ?5 }# X& c" u! V. l: g    "</tbody>" +
& n' m/ I! c: H! G4 q& U* T  "</table>";
9 Z: _5 Z6 @2 F% S5 p  a4 {1 q6 } ) u6 ]4 q( E( S$ ]: t
return myInnovator.newResult(content); / x6 h3 o1 i& d8 N# d
/ Q) H6 y& o2 ]' y- F% o
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了