comparing tables from diefferent databases (using DropDownList and CheckBoxList)

Dec 29 2006 6:33 AM

Friends it is very urgent.................just read.
I have two DropDownList from which i can select database and
I have two CheckBoxList from which i can select table .

when i select any database from DropDownList1 then corresponding table names appear in CheckBoxList1.
similarly in DropDownList2....

PROBLEM is as follows.........
when i select table name from CheckBoxList1 and CheckBoxList2, then matching records from both selected tables (I can select multiple table also) should be displayed (using inner joine).
I used this query but syntax error.........? plz can u modify in the same query or ur wish.

cmd=new SqlCommand("SELECT " +"'DropDownList1.SelectedValue.ToString()'"+ +"'CheckBoxList1.SelectedItem.ToString()'"+ " .Name, "+"'DropDownList1.SelectedValue.ToString()'"+ +"'CheckBoxList1.SelectedItem.ToString()'"+ " .Phone FROM "+"'DropDownList1.SelectedValue.ToString()'"+ +"'CheckBoxList1.SelectedItem.ToString()'"+ " as s1 INNER JOIN "+"'DropDownList2.SelectedValue.ToString()'"+ +"'CheckBoxList2.SelectedItem.ToString()'"+ " as s2 ON s1.Phone=s2.Phone" ,con);

plz can u help me in asp.net(using C#)...
Thanks a lot...
Mujtaba


Answers (1)