Naive Database Question

K

Keith Rebello

I use VB.Net in VS2005 and rarely use databases.



I have a database to which I open a connection in my application (using
ADO). Once I have the connection, I loop through each table in the database
using a command string ("Select * from .) and a DataAdapter to populate a
DataSet. I then close the connection.



If I understand this correctly, I now have a copy of the database in memory.
I cannot seem to find a way to query this DataSet to limit the rows and
columns that I want to see in my DataGridView. Using
DataSet.Tables.Select( , ) I can limit the number of rows based on a
criterion, but cannot seem to limit the number of columns.



Am I trying to do something that is not possible? If it is possible, please
offer some suggestions. Or, do I have to re-open the connection and
re-query the original database?



Keith Rebello.
 
K

Keith Rebello

Thanks Steve.

The problem I have is that the DataGridView will have a different number of
columns and column header names dependent on which table in the dataset I
wish to query. That is why it would be nice to be able to query the DataSet
on a table-by-table basis and have the DataGridView display only pertinent
information.

Keith Rebello
 
K

Keith Rebello

Thanks Patrice. From your post, it makes sense for me to re-connect to and
re-query the database.
For completeness, it is a Windows application and the database is small in
size and is only a small component of the application.

Keith Rebello.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top