|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
6 K4 ~. e: A9 x i
3 h* q! k+ R2 b! i9 i
/ f! U" D6 Q# R/ K+ g, sTechnique 8 ?" f p4 t3 ?) ^) A1 e1 B* P1 i
Use the Innovator.applySQL( … ) method to submit SQL direct to the database. This
* g+ ^$ m/ M: Trecipe returns the XML from the applySQL() method and forms HTML for a table to
7 ?$ h; n- B* s8 y E1 s Idisplay the data.
! n% g' |) N% V' ~& C9 Q# W" p$ n4 q; y. U7 b& |3 p
5 T1 ?4 x' x3 k1 x
C# 5 ^' y( }( w& ^
Innovator myInnovator = this.newInnovator();
% j2 ]( m: i: _+ {8 Q& U! @! IItem results = myInnovator.applySQL( 1 `# n$ G, \. B8 V8 B t
"select login_name,first_name,last_name,email " + $ ^. E( q! y6 l) K8 V* D7 E! _
"from [user] " +
6 l0 [) `0 o. P% m( s' e6 M D "order by last_name,first_name"); ( w- b- Z {6 l7 M" z( i
* v6 w9 L" O3 l, y9 l, Z
string content = "" +
0 s6 X+ c+ c% M& a: O; e: n& z) k "<style type='text/css'>" + 8 W7 M, c5 |: f& n# y( |9 V( J
"table {background:#000000;}" + $ Y5 [0 G, ^1 g( D# ^ P
"th {font:bold 10pt Verdana; background:#0000FF; color:#FFFFFF;}" + : w) G6 f) Y; z# A- E9 t
"td {font:normal 10pt Verdana; background:#FFFFFF;}" + 8 ~% X6 @! v/ y, u: ^. E9 ~
"caption {font:bold 14pt Verdana; text-align:left;}" + . ^4 {/ Z) \, r- [
"</style>" + ) T. \, b: B1 k
"<table id='tbl' border='0' cellspacing='1' cellpadding='2' datasrc='#itemData'>" + ( r/ r1 a7 U$ W" a7 X4 X4 }
"<caption>User Directory</caption>" + 9 ?3 B. g! Q: S" b6 l
"<thead>" +
' D- v0 B5 \' E "<tr>" + ) X3 x( a0 l+ x. X9 G2 f
"<th>Login Name</th>" + . L( [8 ^: k% R$ `8 J
"<th>First Name</th>" + - ]/ v! Z4 V% L+ E
"<th>Last Name</th>" + . W8 Y X; X* O' d E2 e3 e# @
"<th>EMail</th>" +
! C: G9 m' H5 ~. i; f "</tr>" + 2 P9 O. Q, r: z) R$ L8 L
"</thead>" + 6 F, P& K2 I& Z3 _* ~1 T) u+ Y
"<tbody>";
! j7 z( p9 H3 u/ A8 _& @4 H* t9 G3 ?
$ q( R/ c* ^. ]( K0 G4 m s5 Y6 gXmlNodeList users = results.dom.SelectNodes("//recordset/row"); 5 E' h( M9 J& O8 _+ a
for (int i=0; i<users.Count; i++) {
+ c% j; ?5 W/ E: |/ f S content += "<tr><td>" + ((users.SelectSingleNode("login_name") != null) ? $ ]# W& @6 \7 B
users.SelectSingleNode("login_name").InnerText : "") + "</td>"; + C: r+ ?( o/ ]: o3 s
- {/ }" _0 v/ ^$ Y4 B) G# z. y
content += "<td>" + ((users.SelectSingleNode("first_name") != null) ? 5 f- C; S, @7 F) b
users.SelectSingleNode("first_name").InnerText : "") + "</td>";
) J6 Y0 L6 d- D4 u7 z; e5 S
% P2 `% Y h* a9 m! c7 j content += "<td>" + ((users.SelectSingleNode("last_name") != null) ? " s q! g- Q- J) z- E! h- F; {
users.SelectSingleNode("last_name").InnerText : "") + "</td>";
0 c$ W/ u& U% r5 L& W# m : g( N5 L w8 k
content += "<td>" + ((users.SelectSingleNode("email") != null) ? * L( p) a Q/ A; Y9 P5 T2 U9 _
users.SelectSingleNode("email").InnerText : "") + "</td></tr>";
" b! b& i8 M5 S9 Q " i0 C$ }7 G% {6 @
}
; j/ W* |6 X; S+ c$ Q3 I9 H8 C* w - D8 C- _9 ?! q1 T
content += "" + 1 N6 `* k3 m1 c# j% K9 p0 {0 \1 O
"</tbody>" + / q" \, p+ K& x6 i. W+ C
"</table>";
- q1 D# z3 C: `9 {1 u
6 X9 M1 W: e% q9 {& q2 areturn myInnovator.newResult(content); & t+ W- l0 d% X9 T- Y7 f
* S$ G& |* R! ]/ D2 d' d s7 Q |
|