0

I am creating a windows application and for that I am using M S Access as a database. But while performing an insert or update operation I am getting an exception as :
"Cannot open database ''. It may not be a database that your application recognizes, or the file may be corrupt.

I am facing this problem only for single table. In other tables I can perform insert, update operations.
I have tried replacing this database with the one which was previously working. I checked the size of the database and its not above 10MB also. Why is this happening. Previously I was able to perform all operations on the same table.

Please suggest a solution

Mayur
  • 53
  • 1
  • 10
  • Do you know whether this is strictly a c# issue, or a more general problem with the Access database and/or table? For example, can you execute an UPDATE or INSERT to the target table from VBScript? – HansUp Oct 07 '12 at 18:23
  • I don't know how to execute an UPDATE or INSERT to the target table from VBSCript.. :( Can you plz tell me? And I think the problem is with Access table but I am not sure – Mayur Oct 07 '12 at 18:50
  • See insert example in this answer: http://stackoverflow.com/a/7906398/77335 The biggest challenge is getting the connection string right. But, assuming your c# uses OleDb to connect to your Access db file, you probably have that sorted already. There can be an issue with the Jet provider when running your VBScript from 64 bit Windows. If that is your situation, run the script with `SysWOW64\cscript.exe` as described here: http://stackoverflow.com/a/11498650/77335 – HansUp Oct 07 '12 at 19:01

2 Answers2

0

It sounds that you're trying to exeed the maxzimum size.

McGarnagle
  • 101,349
  • 31
  • 229
  • 260
Sirwan Afifi
  • 10,654
  • 14
  • 63
  • 110
  • No... As I said the size is not more than 10MB. And if that would be the case then it would have created problem for all tables in database, right? – Mayur Oct 07 '12 at 18:47
-1

Access isn't suitable for professional developers. it is obviously a corrupted table.

move to SQL Server.

Aaron Kempf
  • 580
  • 2
  • 11