473,325 Members | 2,860 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Query a dataset for binding (ADO.NET)

22
Hi all and thanks for looking.

I need to make the move from ASP to ASP.NET, and as my sister has aked me to knock up a website for her, I thought this could be a nice starter project to help me learn.

The site displays thumnails of images she will upload. Each file needs some information stored in a database about it. In classic asp I would have created a list of images and realated info within a database and driven the site from this. However i thought it would be a nice idea to use the filesystem to list the images.

My plan was to create a DataSet with 2 DataTables. One DataTable full of filenames found in a folder and the other DataTable full of file info loaded from the database. Then I would create a relationship between these tables and (this is where it gets cloudy) bind this to some DataList or something?

So far I have got my dataset with both tables filled with the information as sugested, and created a relationship between them.
Now I'm stuck!!!

How can I bind this information? I still have 2 DataTables! Is it now possible to query this information to put it into a single bindable table or something, or is my whole approach not going to work?

thanks for your time!
Dec 29 '08 #1
8 3406
Frinavale
9,735 Expert Mod 8TB
@TimVtoo
This is exactly what you're going to have to do.

You need to write SQL that queries from both tables to create your "Bindable" table.

Then how you use the table is up to you...you could bind it to a GridView or just use a Repeater to display the images. There's a lot of options at that point.

To get you pointed in the right direction, check out the article on how to use a database in your program.

Also, the MSDN Library is a very powerful resource to use while developing .NET applications. There you can find information on GridViews, DataSets, Repeaters, and much more.

Cheers!

-Frinny
Dec 30 '08 #2
TimVtoo
22
Hi Frinny, thanks for your reply, but i think you may have slightly misunderstood me.

Both of the DataTables I have are ADO.NET tables in the ASP.net application itself as one of the tables is derived from the filesystem. So if I am to create a query to bring this data together, it needs to be done in the application and not a database using ado.net.
My intension here is really to get my head around what I can and cant do with .net AND ADO.net. I have a pretty good understanding of databases, but its the .net i'm new to !
Dec 30 '08 #3
Frinavale
9,735 Expert Mod 8TB
Check out the DataView object and the DataViewManager object.

I think you're going to have to create DataViews for your tables and use the DataViewManager to join them together to be used as a data source for whatever control you're binding the data to.

There might be an easier way to do this....and I'm wondering if LINQ could help you in anyway...but give this a try and if it's not to your liking maybe we can find another solution :)

-Frinny
Dec 30 '08 #4
TimVtoo
22
Thanks Frinny, but as far as I can tell, a data view manager is for hadling Sorting and Filtering for multiple DataTables but they still dont help with combining tables as a join in a database query would. :(

Just to clarify what I'm trying to achieve here.
SIMPLIFIED:
I have an ADO DataTable that contains a list of Image Files found in a specific folder.
I have another ADO DataTable that contains a list of Alias's for these Images.

I am currently diplaying a thumbnail of each image with it's image name underneath it. What i would like to do is display the Alias (from the other table) instead of it's filename under each thumbnail.

Any more suggestions would be welcome!

Thanks

Tim
Dec 30 '08 #5
Curtis Rutland
3,256 Expert 2GB
OK, so just to be sure, it isn't possible to do this at the query level? Write one query that handles your join and returns one table?

If not, you might just have to create your own third DataTable with the columns you need, and loop through and fill in the cells manually.

Also, this might be worth reading:
HOW TO: Implement a Custom DataView Class in Visual Basic .NET
Jan 2 '09 #6
AricC
1,892 Expert 1GB
I'm a bit confused is the data for the folder coming from a DB? If so do what insertAlias said and join the two tables you should have a column in your DB that links the two or are they coming from the file system?
Jan 3 '09 #7
TimVtoo
22
@insertAlias
You are right in saying this can't be done at the query level.

The file/folder info is being done using the DirectoryInfo & FileInfo methods and filling an ado datatable with what it finds.

I took this approach so that it will only ever list files that actually exist AND because I thought it would be a good learning execise.

If nothing else I may have learned that this is not a good approach :).



I'll have a look at the link you posted insertAlias.

Thanks for getting back guys, thought this had dies a death!
Jan 3 '09 #8
TimVtoo
22
OK, it is becoming apparent that relating ado datatable is not going to work for me here.

It has just occured to me (duh) that rather than putting the filnames I find into an ado table I can just use them in a string to build an SQL statement to retreive my alias's right?

But, as I said, i was doing the related ado table thing as a learning excercise, so could someone please give me a good (simple) example of where Relating ADO DataTables is usefull ??

Thanks again for your time!

Tim
Jan 3 '09 #9

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

Similar topics

9
by: M O J O | last post by:
Hi, (I'm new to XML) I can export data from Access as an XML file (with schema integrated in the XML file). I can read it into a DotNet DataSet, but the schema is not correct that is - I do...
5
by: JFB | last post by:
Hi Folks, I have two tables in one dataset customers and orders. If I select a customer form a combo box, how can I set the where statement for the orders table? I want to display all the orders...
10
by: Fares Eidi | last post by:
I am a VB6 intermediate programmer just starting out using VB.net and would like to ask what I'd be missing out on if I just use time saving techniques like data binding, data adapter wizards etc...
10
by: jaYPee | last post by:
as of now i am using a stored procedure from my sql server 2000 to insert record from another table. what i need now is on how can i insert record by not using the stored procedure and insert it...
16
by: Geoff Jones | last post by:
Hi Can anybody help me with the following, hopefully simple, question? I have a table which I've connected to a dataset. I wish to add a new column to the beginning of the table and to fill...
1
by: Abubakar | last post by:
Hi, Lets say I have 3 rows in a dataset bound to a datatgrid. Now I want to add a new blank row before the second row in the dataset. How am I going to do that? I think there was an insertat...
13
by: Maxwell2006 | last post by:
Hi, We are having a debate over using DataSet as return value type for web services. The problem is that we don't know whether Java applications can use DataSet
2
by: forforumsid | last post by:
Hi all I have a Dataset name: dsMain I popullate with all the data from the database on form load event I have a requirement to filter data as per users requirement on a button click event ...
2
by: =?Utf-8?B?UmljaA==?= | last post by:
Hello, I created a simple dll in VB2005 to use ADO.Net -- oleDBDataAdapter to write data to an Excel file. The code (below) works fine from an Excel file (invoke the dll from Excel to write to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.