14 Replies - 391 Views - Last Post: 17 April 2019 - 05:42 PM Rate Topic: -----

#1 JRCharlie   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 21-October 11

Cannot open database (Unknown)

Posted 17 April 2019 - 12:47 PM

Hi all
I have a x32 bit application on a windows10 x64 machine.
The application was working fine untill I change the connection string from OLEDB to ODBC with a DSN.
Since my application x32 bit I created a x32 bit DSN to an ACCESS db wich also is a x32 (Office 365).
When I run the application I receive the error, cannot open database (Unknown) it may not be a database that your application recognizes.
I can oppen the Database from Access fine no pronblem, I also recreated the 32bit DSN dultiple times and the problem still precistes.
  Dim dbcon As OdbcConnection
        Dim cmd As OdbcCommand
        Dim dr As OdbcDataReader
        Dim SelectString As String

        dt = New DataTable
        cmd = New OdbcCommand
        SelectString = "Select * FROM Fees"
        Try
            dbcon = New OdbcConnection("DSN=AUS")
            dbcon.Open()
            With cmd
                .CommandType = CommandType.Text
                .CommandText = SelectString
                .Connection = dbcon
                dr = .ExecuteReader
                dt.Load(dr)
            End With


Is This A Good Question/Topic? 0
  • +

Replies To: Cannot open database (Unknown)

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14995
  • View blog
  • Posts: 59,870
  • Joined: 12-June 08

Re: Cannot open database (Unknown)

Posted 17 April 2019 - 12:53 PM

That doesn't line up with the normal connection string options.
https://www.connecti...s.com/odbc-dsn/
Was This Post Helpful? 0
  • +
  • -

#3 JRCharlie   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 21-October 11

Re: Cannot open database (Unknown)

Posted 17 April 2019 - 12:56 PM

Thanks for you reply
But the database has no password
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14995
  • View blog
  • Posts: 59,870
  • Joined: 12-June 08

Re: Cannot open database (Unknown)

Posted 17 April 2019 - 12:59 PM

What is "AUS" in that connection string?

I would think about using Access specific information.
https://www.connecti...ngs.com/access/
Was This Post Helpful? 0
  • +
  • -

#5 Sheepings   User is offline

  • Senior Programmer
  • member icon

Reputation: 223
  • View blog
  • Posts: 1,260
  • Joined: 05-December 13

Re: Cannot open database (Unknown)

Posted 17 April 2019 - 01:01 PM

Then don't supply one. The structure for the connection string still stands.
Was This Post Helpful? 0
  • +
  • -

#6 JRCharlie   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 21-October 11

Re: Cannot open database (Unknown)

Posted 17 April 2019 - 01:03 PM

The AUS is the DSN name and also the Databasename.
Was This Post Helpful? 0
  • +
  • -

#7 JRCharlie   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 21-October 11

Re: Cannot open database (Unknown)

Posted 17 April 2019 - 01:10 PM

I have used the username and password blank and still get the same error.
I have another project that Im using a pervasive DB with ODBC and a DSN I have successfull connections without user and password.
  Dim dbcon As OdbcConnection
        Dim cmd As OdbcCommand
        Dim dr As OdbcDataReader
        Dim SelectString As String

        dt = New DataTable
        cmd = New OdbcCommand
        SelectString = "Select * FROM Fees"
        Try
            dbcon = New OdbcConnection("DSN=AUS;UID='';PWD=''")
            dbcon.Open()
            With cmd
                .CommandType = CommandType.Text
                .CommandText = SelectString
                .Connection = dbcon
                dr = .ExecuteReader
                dt.Load(dr)
            End With

Was This Post Helpful? 0
  • +
  • -

#8 JRCharlie   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 21-October 11

Re: Cannot open database (Unknown)

Posted 17 April 2019 - 01:25 PM

Hi did a test by swiching the dsn name with a different access database without the username and pwd and the connection opens successfuly.
The differenceis that the AUS Database was createdin Access365 and the other was in access 2010.
Was This Post Helpful? 0
  • +
  • -

#9 Sheepings   User is offline

  • Senior Programmer
  • member icon

Reputation: 223
  • View blog
  • Posts: 1,260
  • Joined: 05-December 13

Re: Cannot open database (Unknown)

Posted 17 April 2019 - 01:38 PM

Might be worth noting; older versions of access files such as 365 can't be opened in newer versions of access. Try convert the database to an .accdb file first. If you can't access your db in access 2010, then your dab must be ancient. Try upgrading the file with a slightly newer modern version to what it was created with.
Was This Post Helpful? 0
  • +
  • -

#10 JRCharlie   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 21-October 11

Re: Cannot open database (Unknown)

Posted 17 April 2019 - 01:41 PM

Thanks for your reply
But the AUS which is the database I'm trying to open is a 365 and it is a .accdb
The one created in 2010 was just used as a test which oppened successfuly.

This post has been edited by JRCharlie: 17 April 2019 - 01:43 PM

Was This Post Helpful? 0
  • +
  • -

#11 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14995
  • View blog
  • Posts: 59,870
  • Joined: 12-June 08

Re: Cannot open database (Unknown)

Posted 17 April 2019 - 01:45 PM

Do you have the 2016 redistribute installed?
https://www.microsof...s.aspx?id=54920
Was This Post Helpful? 1
  • +
  • -

#12 Sheepings   User is offline

  • Senior Programmer
  • member icon

Reputation: 223
  • View blog
  • Posts: 1,260
  • Joined: 05-December 13

Re: Cannot open database (Unknown)

Posted 17 April 2019 - 01:48 PM

I may be wrong, but I think if your db is dated, 19osplash, it might be unable to read it. I'm not a access dude, and I'm not a fan of using it because the db sucks imo and there are better alternatives if you can choose another. Did you create the other db in 2010 and connect to it?

This post has been edited by Sheepings: 17 April 2019 - 01:49 PM

Was This Post Helpful? 0
  • +
  • -

#13 JRCharlie   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 21-October 11

Re: Cannot open database (Unknown)

Posted 17 April 2019 - 01:55 PM

NoI don't have the 2016 redistribute installed.
I din't think I need it asI have the original Access installed.

Yes the Other was created a few years ago in 2010.
what do you mean 19oSplash?

This post has been edited by JRCharlie: 17 April 2019 - 01:55 PM

Was This Post Helpful? 0
  • +
  • -

#14 Sheepings   User is offline

  • Senior Programmer
  • member icon

Reputation: 223
  • View blog
  • Posts: 1,260
  • Joined: 05-December 13

Re: Cannot open database (Unknown)

Posted 17 April 2019 - 02:01 PM

I may be wrong, but I think the distro pack linked above may provide a patch fix. I've recently stumbled on a post which said so. But you will only know if you try it. If not, you will need to update your DB file as stated above. -19osplash - meaning yonks ago
Was This Post Helpful? 1
  • +
  • -

#15 JRCharlie   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 21-October 11

Re: Cannot open database (Unknown)

Posted 17 April 2019 - 05:42 PM

Thank you all for your help.
Installing the 2016 redistribute did the trick.
Now I have access to the DB via DSN.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1