|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
2 k4 o+ y( S' C9 z; A, l/ y! O; Y
1 a; K% o5 D1 x) E, T' M: R6 C' t! G; e0 f9 r; m( ?+ _
Technique ( ~+ M* z6 M1 e$ X% M
Use the Innovator.applySQL( … ) method to submit SQL direct to the database. This
# e* f/ A Q' }, T1 A5 Q! Grecipe returns the XML from the applySQL() method and forms HTML for a table to
; a$ V J$ G* M% m4 e$ X( q5 Sdisplay the data. : T: E1 }) H* I( z
" f1 Z5 q4 \4 @4 I; g
: v2 Y- g5 L. c% }. W) Q; [
C#
2 u+ B& {: O. |1 R& v: {3 b" kInnovator myInnovator = this.newInnovator(); 3 s+ R* L# i9 I* f& ~5 N* `8 U
Item results = myInnovator.applySQL( 9 P) w8 J/ v+ d7 J+ H; q
"select login_name,first_name,last_name,email " + G5 l: }3 Z8 F& g5 J2 B9 A
"from [user] " + : E e$ v: e7 F* b* W' r7 s
"order by last_name,first_name"); 8 j) [1 D3 x; w, o) Y# p; b
: Z% ^" V+ K' lstring content = "" + ' C' E) i5 `7 G5 {9 t* ~" M
"<style type='text/css'>" + % H. [* X# k# G/ U- `
"table {background:#000000;}" + / B8 ]9 c' q$ X- V5 y; w" t
"th {font:bold 10pt Verdana; background:#0000FF; color:#FFFFFF;}" +
3 E7 _9 p2 m: _& r "td {font:normal 10pt Verdana; background:#FFFFFF;}" +
4 Z- U" E8 v. Z6 d( {6 z3 [ "caption {font:bold 14pt Verdana; text-align:left;}" + Y+ J# V6 ~) {/ X; j$ u( Y$ P
"</style>" +
3 X1 L, I P3 Q6 h/ C5 i. _/ G3 J "<table id='tbl' border='0' cellspacing='1' cellpadding='2' datasrc='#itemData'>" +
1 ?/ O7 z$ }! C* S2 ]: R6 ` "<caption>User Directory</caption>" +
- \) q% s- W1 [; @$ I4 ^ "<thead>" + % n3 x/ q1 A% `6 Y
"<tr>" + 2 M! U1 K: @9 A3 P+ h2 e
"<th>Login Name</th>" +
( |9 R+ W; t4 X% @8 p "<th>First Name</th>" + % o* D- d% F. A* ~* `
"<th>Last Name</th>" +
3 x7 m, b( E- u "<th>EMail</th>" +
8 g* [, r# v9 C; z# F- \3 g+ S "</tr>" +
9 c4 \- ?/ k, O3 ? "</thead>" + / k# A. G2 z$ p8 d
"<tbody>";
6 o8 Q0 {2 [4 h/ W3 d( v3 O, F
% C: w* t R- u4 f& aXmlNodeList users = results.dom.SelectNodes("//recordset/row");
; I! m( x# D6 A" s: Nfor (int i=0; i<users.Count; i++) {
' a' [- }& x1 R content += "<tr><td>" + ((users.SelectSingleNode("login_name") != null) ?
- S. |5 Z* ? C, z6 Z6 S% Z users.SelectSingleNode("login_name").InnerText : "") + "</td>";
4 w" L! Z3 P" a# w6 x . @9 c. R. g& i6 D7 F/ C( q
content += "<td>" + ((users.SelectSingleNode("first_name") != null) ? ) Q5 p! n$ w; `; w7 j3 Q" I; `- A
users.SelectSingleNode("first_name").InnerText : "") + "</td>"; ( c. ?% l: ?) { K4 z$ u
, C5 m7 ^4 m7 Q% t content += "<td>" + ((users.SelectSingleNode("last_name") != null) ?
' q, D! W1 u+ l; w9 ^5 L7 g users.SelectSingleNode("last_name").InnerText : "") + "</td>"; % y* k! [8 J0 o
, T* A% y2 _7 A! j9 K' _* K content += "<td>" + ((users.SelectSingleNode("email") != null) ? 2 b: T' d. m& }9 b6 n7 X
users.SelectSingleNode("email").InnerText : "") + "</td></tr>";
# c. L7 e w. _9 @0 v 7 c1 l: C7 }! B7 ^* Z4 i* R( M
} 9 N7 t% z# b- A- I+ U7 n# k' i7 V# l
. Y0 i8 o, h9 j M8 q" X9 x5 @+ g
content += "" + 4 D2 K- o: X, \4 }/ h
"</tbody>" + / J2 }4 x% S# P% b }( D. c
"</table>";
: i! M% k( r$ a/ w2 U 3 ~' H. j9 M, A# x" H9 |
return myInnovator.newResult(content);
# e6 j9 Q, a/ ^9 t7 H, W! M+ j6 ?0 {# S# x
|
|