Trouble with connecting Access DB

Lance James 371 Reputation points
2022-02-17T00:04:30.367+00:00

The C# code throws this error for this connection string: Provider=Microsoft.ACE.OLEDB.12.0;Data Source=W:\SAP_POPfcst_2022-02-16.mdb

175155-image.png

However, I setup the same connection using the wizard and the test connection is fine.
175145-image.png

Any thoughts why the wizard find the provider but code does not?

Regards,
Lance

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,844 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Anonymous
    2022-02-17T00:48:40.017+00:00

    The double backslash?

    0 comments No comments

  2. Lance James 371 Reputation points
    2022-02-17T23:20:12.087+00:00

    In the Project Tab, Properties, this window opens. Deselect Prefer 32-bit and set Platform target = x64. Early in this thread JackJJun-MSFT suggested setting the platform to X64 but did not elaborate on how to do what he suggested. This is the solution. Thanks Jack. I found it.
    175625-image.png

    Good luck all,
    Lance

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.