Binding Gridview with variable number of records
hi ,
I have a variable string e.g. ("25,3,45,32") which is stored in a field of Table.The String is of variable length, it could be "1,4,22" or "456,54,32,21,56,89,57" in datbase(SQL 2005)
The problem is that I have to access the records from anathor table where the comma separated values of string is a field (i.e ID)
Table1 Table2 Result(I Want)
------------ ------------ ----------------------
id Name strID Name
------------ ------------ -----------------------
1 a 2,3,11 b,c,f
2 b 2 b
3 c 1,3,6,9,11,31 a,c,d,e,f,g
6 d 1,3,32 ---and so on---
9 e 11
11 f 6,9
31 g 1
32 h 31,32
I want a single Function or Procedure that will access the values strID from begining to end of Table2 and join the records in Table1
with the IDs that are in the String.When all Records will be accessed by all rows of Table2 from Table1, then the Resultent Data has to be bind with DataBound Control(Gridview)
if you know How to do this ,please tell me how .
-----Kamal
Thanks.
|