dotnet / dotnet/dotnet-api-docs

Setting the value to null

Open
#1,790 0 comments 0 reactions 0 assignees View on GitHub
area-System.Data.SqlClient dotnet-api/prod Pri2 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

What does it mean "To set the value to null, use Value."? The "Value" refers to DBNull.Value (https://docs.microsoft.com/en-us/dotnet/api/system.dbnull.value?view=netframework-4.7.2), but of course that type cannot be assigned to this string property.

One way to unset the credentials could be as follows:

sqlConnectionStringBuilder.Remove("User ID");
sqlConnectionStringBuilder.Remove("Password");

But I am not sure if this is correct and/or the most convenient way.

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: 0ac2336d-13e5-33b1-c7dd-251afaca94f5
* Version Independent ID: 85d8ed78-b9f0-1572-46dc-dafb997b5115
* Content: [SqlConnectionStringBuilder.UserID Property (System.Data.SqlClient)](https://docs.microsoft.com/en-us/dotnet/api/system.data.sqlclient.sqlconnectionstringbuilder.userid?view=netframework-4.7.2#System_Data_SqlClient_SqlConnectionStringBuilder_UserID)
* Content Source: [xml/System.Data.SqlClient/SqlConnectionStringBuilder.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.Data.SqlClient/SqlConnectionStringBuilder.xml)
* Product: **dotnet-api**
* GitHub Login: @douglaslMS
* Microsoft Alias: **douglasl**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.