|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
7 ^9 G3 o9 c+ O6 l8 _- [ ]# I4 x
N; d2 h; t, g0 r
- ^9 S$ W. T( [Technique 6 Y6 I* [! z. H/ O8 C6 K
Use the Innovator.applySQL( … ) method to submit SQL direct to the database. This
5 `) |( s% ?# J7 W9 U" h) ]6 drecipe returns the XML from the applySQL() method and forms HTML for a table to 1 `! j" a% G& z, S' N& s
display the data. 4 j: L- b9 V4 Q; A
) ^5 J! ]( ]0 ?; j& }
8 }9 G: |8 A# p3 g5 c
C#
1 r! W" j; Y$ DInnovator myInnovator = this.newInnovator(); / k5 j& j Q$ l8 Z3 k0 R
Item results = myInnovator.applySQL( 1 s* |* [) _% |+ P. t
"select login_name,first_name,last_name,email " +
$ D" S0 A% P, w- {. |3 e5 L) D9 _ "from [user] " +
9 @" D$ r8 F1 y$ n0 Q9 v% X "order by last_name,first_name");
. u2 F6 W! h5 g) D$ L
4 Q! n" S. H+ j+ dstring content = "" + ( p; n1 [5 V8 t2 j: j
"<style type='text/css'>" +
X8 @5 S4 Z$ ~ "table {background:#000000;}" +
6 J/ {( s+ N$ N "th {font:bold 10pt Verdana; background:#0000FF; color:#FFFFFF;}" + : i L5 e7 Y; ?" R8 O" a0 _1 ?
"td {font:normal 10pt Verdana; background:#FFFFFF;}" + / G' U. J( @& z; S; v: A0 f3 [7 I
"caption {font:bold 14pt Verdana; text-align:left;}" + & C9 Z: `+ F6 D
"</style>" +
0 N% K9 f f9 C5 I% v6 d "<table id='tbl' border='0' cellspacing='1' cellpadding='2' datasrc='#itemData'>" + , t, O9 B+ ?/ p/ }0 i
"<caption>User Directory</caption>" +
& A, t+ S5 C8 i _ "<thead>" + $ t0 J( b# |$ z, K4 O
"<tr>" +
. E, O; H$ \: F ~ "<th>Login Name</th>" + ; w( `# z: _9 B/ \+ Y. W8 u" f) a
"<th>First Name</th>" + ( K7 m2 i0 T1 a R, J4 c- U! G4 w
"<th>Last Name</th>" +
: x; q* L* h3 ^; \ "<th>EMail</th>" + 2 P0 o: K3 M" Z0 T% ]
"</tr>" + 2 l/ O* s4 F, n$ x4 e) b3 F$ q/ L
"</thead>" + 0 q" q7 G1 N+ X1 l
"<tbody>";
5 k( `* K. M) G3 E* H Y( e
* W# r/ _; Z, uXmlNodeList users = results.dom.SelectNodes("//recordset/row");
8 k' O$ W; U2 k4 g/ m v, n. Jfor (int i=0; i<users.Count; i++) {
) }# ?" a$ O' F! ^( @8 s: V6 B4 j content += "<tr><td>" + ((users.SelectSingleNode("login_name") != null) ? 4 U, @1 A3 Y$ |: o
users.SelectSingleNode("login_name").InnerText : "") + "</td>";
( H/ U( y$ b9 z( j% Z $ N; N2 v- Z; Q& W1 [, p
content += "<td>" + ((users.SelectSingleNode("first_name") != null) ?
f, o B# B4 G users.SelectSingleNode("first_name").InnerText : "") + "</td>"; 3 `& V: i, B# |- n7 N
4 a7 w0 r$ ~5 n4 i9 ]& h% g o3 [
content += "<td>" + ((users.SelectSingleNode("last_name") != null) ?
' I7 s) I2 E6 P1 B users.SelectSingleNode("last_name").InnerText : "") + "</td>"; 1 _* Z8 w" G) O. F2 Z
! p1 Y/ D M* s4 ?# d
content += "<td>" + ((users.SelectSingleNode("email") != null) ? 2 J- u: e. Y U+ h4 F Z
users.SelectSingleNode("email").InnerText : "") + "</td></tr>"; % [' O( M+ T0 }) q' W& E. {8 ]
) Z" y9 {! s* a6 w5 m* }
}
* ~" @$ H E5 }& X $ X' S) K& v4 K+ }
content += "" +
5 G" {' D8 Z4 y- a' [4 J "</tbody>" +
' h; X( a# I+ l" R% x "</table>";
% C! _! I% _1 X/ K2 U, U( E8 \( e" l
8 P- Q: B4 ?9 W& a4 M& kreturn myInnovator.newResult(content);
- l. w. l* {2 f# l3 @1 |) b8 Q
, h0 G% d$ J( |3 Z |
|