By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,066 Members | 1,841 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,066 IT Pros & Developers. It's quick & easy.

two columns in a listview can be from different tables???

100+
P: 103
say id and name be two columns in a listview,wher both are from two differnt tables,
1st table contains id and name
11nd table contains id and age,11nd table contains ids from first table but not whole ids but half of it...

how can we write the code in vb
Jan 9 '08 #1
Share this Question
Share on Google+
9 Replies


Expert 100+
P: 487
Explain your problem detail and no confuse. Are you talking about Inner Join or Left Join Sql queries?
Jan 9 '08 #2

lotus18
100+
P: 866
say id and name be two columns in a listview,wher both are from two differnt tables,
1st table contains id and name
11nd table contains id and age,11nd table contains ids from first table but not whole ids but half of it...

how can we write the code in vb
This could be done in your query.

Rey Sean
Jan 9 '08 #3

100+
P: 103
Explain your problem detail and no confuse. Are you talking about Inner Join or Left Join Sql queries?
in a single form 2 listview controls,one listview contains....id and name
11nd listview contains work doneby employee(in hours)

in the first listview control,id and name,where id cmes from table say tab1 which has columns id,workdone,gross salary(of emp)
11nd listview control,workdone(in hours)
my doubt occurs here where id can be added from tab1 and i need name to populate from table tab2
tab1-id,name,age
tab2-id,workdone,grosssalary
whereas all ids in tab1 is not there in tab2

thanks in advance
Jan 9 '08 #4

jamesd0142
100+
P: 469
This could be done in your query.

Rey Sean
Really, i tried this:

"select * from TBLUsers Select * from TBLOther"
and it didnt work
but when i simply use 1 select statemement:
"select * from TBLUsers"
it works fine...

Can you explain by anychance?
Jan 9 '08 #5

Expert 100+
P: 487
i..
whereas all ids in tab1 is not there in tab2
thanks in advance
I can assume what you are trying,
1. keep tab2 listview empty and fill the tab1 listview1 with your select query (or in your way).
2. when user click tab1 listview (in tab1 listview click event fill tab 2 listview with selected value from tab1 listview) and show tab2 listview.
Jan 9 '08 #6

debasisdas
Expert 5K+
P: 8,127
say id and name be two columns in a listview,wher both are from two differnt tables,
1st table contains id and name
11nd table contains id and age,11nd table contains ids from first table but not whole ids but half of it...

how can we write the code in vb
you need to use JOIN in SQL query to retrive matching data from both the tables
else create a view based on join and select data from the view and populate the listview.
Jan 9 '08 #7

Expert 100+
P: 487
for the above suggestion we donít need joins. (Of-course joins and grouping is required but not in this case is it?)
Jan 9 '08 #8

debasisdas
Expert 5K+
P: 8,127
for the above suggestion we donít need joins. (Of-course joins and grouping is required but not in this case is it?)
Join is required if using only 1 list view.

if want to use two pass the vale from listview1 and pass that to SQL query ,fetch the data and populate the second.
Jan 9 '08 #9

jamesd0142
100+
P: 469
Join is required if using only 1 list view.
Cheers debasisdas works great now
Jan 9 '08 #10

Post your reply

Sign in to post your reply or Sign up for a free account.