VS 2008 Data Access Issues

  • Thread starter Thread starter Wesley Peace
  • Start date Start date
W

Wesley Peace

I'm an occassional programmer who has been playing around with C#.

I've built database applications before, but running into problems with C#
and using data access controls to do a simple thing like display the data in
the datagridview control.

I'm using an Access database as the backend data store and I am able to
preview the data in the tables in design mode but when the application runs
no data is displayed. The datanavigation control shows no records either and
when I attempt to add a record it is not saved.

I know I'm missing something, but I'm at a lost at this point. A search of
MSDN doesn't appear to help. It appears I'm doing everything right.

VS 2008
C#
Jet 4.0
Access 2007 database


Thoughts
 
First place to check is the connection string. Second is permissions on the
Access file and directory it sits in. Third is to make sure nobody has the
database open, or it is set up for multiple users.

If that does not work, post more.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
 
Connection string is pretty generic and doing a preview on the data does ope
the table successfully. So I am able to access the database but only in
design mode. I also tested the connection so I know that is working.

This is sitting on my desktop so permissions should not be an issue. I've
also tried recreating this in VB and on a different machine. Believe it or
not I tried SQL Compact edition and noticed the same problem.

An interesting note is in prior versions of VB I was able to drag the tables
over to the form. Now I'm not. The Walktrhrough docs say this is possible.

I'll check the latter two items again, but I'm the only one using this
database and the machine it's sitting on.
 
If a website:
The permissions you have to watch are the permissions for the account that
ASP.NET runs under. If it cannot create a file in the directory or access
the Access file, you will have a failure. The reason for write on the folder
is the lock file is created when someone opens the database file, even from
a website.

Otherwise:
Ensure you have all rights to write in the folder and non of your code is
impersonating anyone else.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
 
Back
Top