How do I fill a datagrid with data using DAO

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

We have an old app that uses DAO 3.51 with VB5.
I need to attach the table in that .MDB to a datagrid in .net. The table
will be one or two columns wide. Is there a piece of code some where that I
can use as an example of how to attach them together?
Thanks
Rich
 
Hello RichG,

Have u tried to connect to the MDB with ODBC driver?

R> We have an old app that uses DAO 3.51 with VB5.
R> I need to attach the table in that .MDB to a datagrid in .net. The
R> table
R> will be one or two columns wide. Is there a piece of code some where
R> that I
R> can use as an example of how to attach them together?
R> Thanks
R> Rich
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
No I haven't. I'm very unsure of the relationship the DataSets or DataViews
have with DAO.DataBases or DAO.Recordsets. I have used the examples given in
the Help system but I get an invalid cast error on

myDataSet = CType(db, DataSet)
where "db" is a DAO Database. If I substitute an open recordset, "rs", in
the place of "db", I still get the invalid cast error.

So I need a code snippet to see the correct syntax required.

Thanks
 
Hello RichG,

Don't u need to use .NET to get data from this table?
I recomend to check ODBC drivers to create connection to this DB and then
use ODBCConnection


R> No I haven't. I'm very unsure of the relationship the DataSets or
R> DataViews have with DAO.DataBases or DAO.Recordsets. I have used the
R> examples given in the Help system but I get an invalid cast error on
R>
R> myDataSet = CType(db, DataSet)
R> where "db" is a DAO Database. If I substitute an open recordset,
R> "rs", in
R> the place of "db", I still get the invalid cast error.
R> So I need a code snippet to see the correct syntax required.
R>
R> Thanks
R>
R> "Michael Nemtsev" wrote:
R>---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
Hi Michael
Getting to the .MDB and a table in .Net is just like doing it in VB5.
Dim db as DAO.Database
Dim rs as DAO.Recordset
set db=OpenDatabase(path & "name.mdb")
set rs=db.OpenRecordset("SomeTable")

That gives me db as a database and rs as a recordset
I believe that is what I would endup with if I used ODBC.
I may be very wrong as I have used ODBC only once a
couple of years ago.

What do I do with them them as related to a datagrid?
Rich
 
Back
Top