Skip to content

Commit b4a8b42

Browse files
authored
ROPC fixes for ADO.NET (dotnet#10728)
1 parent bc175b4 commit b4a8b42

File tree

39 files changed

+108
-1621
lines changed

39 files changed

+108
-1621
lines changed

snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.Values/CS/source.cs

Lines changed: 0 additions & 20 deletions
This file was deleted.

snippets/csharp/VS_Snippets_ADO.NET/DataWorks OdbcConnectionStringBuilder.Keys/CS/source.cs

Lines changed: 0 additions & 50 deletions
This file was deleted.

snippets/csharp/VS_Snippets_ADO.NET/DataWorks OdbcConnectionStringBuilder.Multiple/CS/source.cs

Lines changed: 0 additions & 50 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Library</OutputType>
5+
<TargetFramework>net8</TargetFramework>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<PackageReference Include="System.Data.Odbc" />
10+
</ItemGroup>
11+
12+
</Project>
Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
using System;
2-
using System.Data;
32
// <Snippet1>
43
using System.Data.Odbc;
54

65
class Program
76
{
87
static void Main()
98
{
10-
OdbcConnectionStringBuilder builder =
11-
new OdbcConnectionStringBuilder();
12-
builder.Driver = "Microsoft Access Driver (*.mdb)";
9+
OdbcConnectionStringBuilder builder = new()
10+
{
11+
Driver = "Microsoft Access Driver (*.mdb)"
12+
};
1313

1414
// Call the Add method to explicitly add key/value
1515
// pairs to the internal collection.
1616
builder.Add("Dbq", "C:\\info.mdb");
17-
builder.Add("Uid", "Admin");
18-
builder.Add("Pwd", "pass!word1");
1917

2018
Console.WriteLine(builder.ConnectionString);
2119
Console.WriteLine();
@@ -30,16 +28,11 @@ static void Main()
3028
builder.ConnectionString =
3129
"driver={IBM DB2 ODBC DRIVER};Database=SampleDB;" +
3230
"hostname=SampleServerName;port=SamplePortNum;" +
33-
"protocol=TCPIP;uid=Admin;pwd=pass!word1";
31+
"protocol=TCPIP";
3432

35-
Console.WriteLine("protocol = "
36-
+ builder["protocol"].ToString());
33+
Console.WriteLine($"protocol = {builder["protocol"].ToString()}");
3734
Console.WriteLine();
3835

39-
// Modify existing items.
40-
builder["uid"] = "NewUser";
41-
builder["pwd"] = "Pass@word2";
42-
4336
// Call the Remove method to remove items from
4437
// the collection of key/value pairs.
4538
builder.Remove("port");
@@ -54,9 +47,6 @@ static void Main()
5447
// necessary.
5548
builder["NewKey"] = "newValue";
5649
Console.WriteLine(builder.ConnectionString);
57-
58-
Console.WriteLine("Press Enter to finish.");
59-
Console.ReadLine();
6050
}
6151
}
6252
// </Snippet1>

snippets/csharp/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder.Ctor/CS/source.cs

Lines changed: 0 additions & 55 deletions
This file was deleted.

snippets/csharp/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder.Keys/CS/source.cs

Lines changed: 0 additions & 55 deletions
This file was deleted.

snippets/csharp/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder.Provider/CS/source.cs

Lines changed: 0 additions & 55 deletions
This file was deleted.

snippets/csharp/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.Ctor/CS/source.cs

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)