鲜花( 2) 鸡蛋( 0)
|
There are two tables such as AA and BB, assume there is empid field in AA, and there is empid field in BB, and your grid view's name is gdv, so:
1 i" B: g& P! D8 Z) J4 f1 .sql statement is:% ^3 X3 O' F: E; G7 S* x; B
select AA.empid, AA.XX, BB.XX from AA inner join BB on AA.empid=BB.empid
" e8 a. n6 ~6 r$ G4 J2. show data in grid view
, T" k$ |, G4 k2 I5 x" D- n; d+ qthen used DataTable get the result, for example Datatable name is dtResult:! u/ _# D& Q7 D7 l4 r2 y2 c
code is :
3 Y q1 o5 G& H$ V( y. [: Mgdv.datasource=dtResult;
2 `3 K: U' E Q. S5 i0 lgdv.DataBind();
: J" z+ I t; G% ` |/ `2 }/ O& R) @# h% I# A) V* t6 m, s& B! O
8 Z7 i2 X9 ~( p! u
5 e c+ c: z% w* `0 g9 b5 p1 a0 N# }, w: s( D0 ~
/ X7 _) j& H0 `% M' Q
|
|