How to insert records in Table3

Sep 13 2010 1:56 AM

I am having 2 tables. In 1 table i am having 10 columns. out of 10 i m inserting 9 column values with the Table Structure of Column Names but in 10 th Column(This Column is not Declared in Table1 but Declared in Table 2). i am inserting Text But this Text is having ID values in Table 2.

Ex:-

Table1

Col1   Col2   Col3 ---------Col9                   Col10

1       ff         fd  ----------- HowToGet ID?       xyz


Table2

Col1   Col2

1        Admin

2        Role1

3        Role2


Now in My inserting Code Snippet is like this....

List<string> roles = new List<string>();
            roles.Add("Admin");
            roles.Add("Role1");
            roles.Add("Role2");


There is a Table3 Mediator. to get the ID values

Table3

Col1                 Col1                 Col2

   Val                Table2Col1      Table1Col9


Now my Question is if a user Registering of 19 th Record of Table1 it has to get the Values of  Table 2 all 3 Values Because in List<string> we declared three values na. It has to Fill upthe Table3  like.

Col1                 Col1                 Col2

  21                    19                     1

  22                    19                     2

   23                   19                     3


How can I Fill up like this Table3. Now while i am inserting record of 19th it has to get the value of  Table3 and  19 th Record has to Fill up Successfully...


How to implement this 1??

I think CROSS JOINS are suitable it might be but we should pass Condition in CROSS joins if i am passing  without a condition  its not executing... I MIGHT be wrong