Having issue with Keyword not supported: 'trust server certificate in Visual Studio VB

Cesar Rivas 0 Reputation points
2023-08-11T17:02:43.75+00:00

Hi. I'm trying to run VB code in visual studio form project but get an error when code is trying to run. Error is: "System.ArgumentException: 'Keyword not supported: 'trust server certificate'.'". The line in code affected is:

Data Source=CDOPWD-4023;Initial Catalog=PREVENTION_DATABASE;Persist Security Info=True;User ID=cesrivas;Password=***********;TrustServerCertificate=True

VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,580 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Jiachen Li-MSFT 26,751 Reputation points Microsoft Vendor
    2023-08-14T01:39:48.3366667+00:00

    Hi @Cesar Rivas

    Not all data providers or database systems support this option.

    If you're working with a database system that doesn't support this option, you'll need to remove the TrustServerCertificate=True part from your connection string.

    Best Regards.

    Jiachen Li


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    5 people found this answer helpful.

  2. Abhay Sharma 5 Reputation points
    2024-04-28T06:15:18.9633333+00:00

    Yes, after removing "Trust Server Certificate=False" from connection string
    "Data Source=__-LAPTOP\SQLEXPRESS;Initial Catalog=MovieRentalDb;Integrated Security=True;Pooling=False;Encrypt=False; Trust Server Certificate=False", it worked for me.

    Modified connectionString :-

    "Data Source=____-LAPTOP\SQLEXPRESS;Initial Catalog=MovieRentalDb;Integrated Security=True;Pooling=False;Encrypt=False"

    1 person found this answer helpful.
    0 comments No comments