Share via

Trouble with connecting Access DB

Lance James 371 Reputation points
Feb 17, 2022, 12:04 AM

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.
11,381 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Anonymous
    Feb 17, 2022, 12:48 AM

    The double backslash?

    0 comments No comments

  2. Lance James 371 Reputation points
    Feb 17, 2022, 11:20 PM

    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.