bobdylan75
asked on
Programmatically connect msaccess table to datagridview
Hi,
How can I connect msaccess table to dataGridView object?
there are an easy sample code?
I want to connect it programmatically in Vb.net.
Thanks
How can I connect msaccess table to dataGridView object?
there are an easy sample code?
I want to connect it programmatically in Vb.net.
Thanks
ASKER
Thanks, but using that code It gives me a not define error "E_FAIL" on the FILL code line.
I'm using VS2005.
I'm using VS2005.
Did you make the adjustments to your database ?
1. Data Source=C:\Mydb.mdb
2. select * from ....
1. Data Source=C:\Mydb.mdb
2. select * from ....
ASKER
yes I do!
the path is correct and the SQL too..
if I use the "automatic objects" it works,
If I do it programmatically gives me an error..
I'm thinking to make a test in a standalone project..
I would use the "automatic objects" but in the file.config it creates
a string with an absolute path, I would like use a relative one..
But the programmatically solution is what I prefer..
the path is correct and the SQL too..
if I use the "automatic objects" it works,
If I do it programmatically gives me an error..
I'm thinking to make a test in a standalone project..
I would use the "automatic objects" but in the file.config it creates
a string with an absolute path, I would like use a relative one..
But the programmatically solution is what I prefer..
What is the exact error ?
ASKER
System.Data.OleDb.OleDbExc eption was not handled
ErrorCode=-2147467259
Message="IErrorInfo.GetDes cription failed with E_FAIL(0x80004005)."
Source="System.Data"
...
ErrorCode=-2147467259
Message="IErrorInfo.GetDes
Source="System.Data"
...
ASKER
One moment..
I have change the database..
I've choosen another one,
and everything runs.
But I have to use the other database..
I have done it with MsAccess2007 comptible with access 2002/2003..
I'm thinking that the problem should be here..
I have change the database..
I've choosen another one,
and everything runs.
But I have to use the other database..
I have done it with MsAccess2007 comptible with access 2002/2003..
I'm thinking that the problem should be here..
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok it works fine,
and if I want to add a user/passowrd to the database?
and if I want to add a user/passowrd to the database?
With database password
This is the connection string to use when you have an Access 2007 database protected with a password using the "Set Database Password" function in Access.
Quote:
Provider=Microsoft.ACE.OLE DB.12.0;Da ta Source=C:\myFolder\myAcces s2007file. accdb;Jet OLEDB: Database Password=MyDbPassword;
This is the connection string to use when you have an Access 2007 database protected with a password using the "Set Database Password" function in Access.
Quote:
Provider=Microsoft.ACE.OLE
By the way. When you add a question, you can assign multiple zones for one question. If you do that, you'll probably reach more experts
This question could be also under the next zones: Visual Studio, VB.NET
This question could be also under the next zones: Visual Studio, VB.NET
(you need to set the connection and sql-string correctly to your project)
Open in new window