tags:

views:

433

answers:

4

I have used the connection string below but I am getting an error when trying to create a table

Dim ConnString As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & strFName + _ ";Extended Properties=""Excel 12.0 Xml;HDR=YES;IMEX=1"""

Cannot modify the design of table 'tablename'. It is in a read-only database.

A: 

If the database is read-only, then by definition you will not be able to create any tables in it.

Mitch Wheat
A: 

my question still remain that i am creating a new table to be used in a Ms Excel file

A: 

I'm personally using the following to connect to an access database:

    _source = "..\db.mdb"
    Dim strconnexion As String
    strconnexion = "Provider=Microsoft.Jet.OLEDB.4.0;"
    strconnexion &= "User ID=Admin;Password=;"
    strconnexion &= "Data source=" & _source
    _cnBd = New OleDbConnection (strconnexion)
    _cnBd.Open()

Hope this helps.

Ownatik
A: 

Your problem is the IMEX=1. That tells excel to open in "import mode" making the connection read-only. I had the same issue, weird weird stuff.

Take that out and it works like a charm.

Jonathan DeMarks