Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Binding one datalist to multiple tables?

Status
Not open for further replies.

collegian

Programmer
Jul 1, 2010
64
US
Hello All,

I just wanted to know if there is any way in which I can bind one datalist to multiple tables? I can use multiple datalists but I think that would look ugly.I need to implement a site wide search functionality.Any suggestions will be appreciated.

Thanks.
 
aggregate the results into a single table and bind to the datalist.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
faq732-7259
 
Thanks for the reply.I can't think of anything other than using SQL Join statement.However,I am not sure if I can use that in my context since there is nothing in common between the tables!
 
you have some options.
1. use sql either; through a temp table and a series of insert into sql commands or a massive union query.
2. get the results from each "source" into a datatable, then merge all of these results into a single datatable using code.
3. I'm sure there are others, the only limit is your imagination.

if you are relying on VS drag-n-drop Wizards then I can see why this seems impossible. WYSIWYG cannot do this for you. you will need to write the code/sql yourself.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
faq732-7259
 
Union doesn't work with columns having different data types.I tried doing the second option which you suggested but it didn't work,maybe I need to give it another shot!

If nothing works soon, I'll have to go with multiple datalists :(
 
I see this going 1 of 2 ways. either the data can be presented in a similar fashion and you can use a common type to represent it. or the data is so heterogeneous than it should not be displayed as a single common set of information.

in the end it's all text anyway, you can always default to that.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
faq732-7259
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top