How to use encrypted DB connectionString at DataSet.xsd?

Min 0 Reputation points
2025-04-29T01:25:33.5266667+00:00

Hello.

I'm want use DataSet.xsd in .Net Framework 4.5 c# winform project with encrypted connection string.

User's image

I execute below

  1. adding TableAdapter in DataSet from Designer view
  2. connecting TableAdapter with db using by ConnectionString
  3. ConnectionString for TableAdapter saved project/settings by plain. no encrypted.

I can redesign code for encrypted connection string from DataSet.Designer.cs/TableAdapter.InitConnection()

enter image description here

and delete plain connection string that stored in project/settings for secure. but it occurs error when execute some command in DataSet Designer view.

I know its natural things. but its neccerary to secure program.

This is the question.

  1. How to use encrypted connection string in DataSet designer view without error?
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,431 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Karen Payne MVP 35,566 Reputation points
    2025-05-02T17:49:42.2833333+00:00

    You should not edit the TableAdapter as shown. You can use the following class ConnectionStringSecure for runtime. Then before the TableAdapter.Fill use DecryptFile then EncryptFile.

    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.