473,756 Members | 1,818 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Query a dataset for binding (ADO.NET)

22 New Member
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 3436
Frinavale
9,735 Recognized Expert Moderator Expert
@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 New Member
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 Recognized Expert Moderator Expert
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 New Member
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 Recognized Expert Specialist
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 Recognized Expert Top Contributor
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 New Member
@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 New Member
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
6775
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 not get the right columns. Is there some kinda trick to convert the XML to a DotNet-DataSet-readbable file??
5
964
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 for that particular customerID in dynamic way. Any samples?? Tks for you help. JFB
10
1924
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 to create my front end application. Building the data access forms using manual coding just seems like a lot of work.... Any guidance would be appreciated Fares
10
2641
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 using dataset. here is my code in stored procedure.. CREATE PROCEDURE AddRegularLoad @SchYrSemID as int, @ProgramID as int, @Sem as varchar(50), @Year as
16
2487
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 it with incremental values e.g. if the tables looks like this: 23 56
1
1566
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 method of dataset that I tried but wasnt working correctly. A short working code will help. I'm doing this in vs.net 2k3. Thanks,
13
2367
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
2731
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 What I want is that when the user clicks the button the program should query the Dataset table and not the database table and return the result
2
1726
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 another Excel file) But if I run the same dll (tlb) from MS Access - I get an error that I need to use an updateable query. Why does the following code work fine in Excel but not in MS Acces? Maybe because Excel doesn't use Jet? Any...
0
9456
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10034
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9872
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9843
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7248
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5142
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3358
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.