Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net8</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Data.Odbc" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
using System;
using System.Data;
// <Snippet1>
using System.Data.Odbc;

class Program
{
static void Main()
{
OdbcConnectionStringBuilder builder =
new OdbcConnectionStringBuilder();
builder.Driver = "Microsoft Access Driver (*.mdb)";
OdbcConnectionStringBuilder builder = new()
{
Driver = "Microsoft Access Driver (*.mdb)"
};

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

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

Console.WriteLine("protocol = "
+ builder["protocol"].ToString());
Console.WriteLine($"protocol = {builder["protocol"].ToString()}");
Console.WriteLine();

// Modify existing items.
builder["uid"] = "NewUser";
builder["pwd"] = "Pass@word2";

// Call the Remove method to remove items from
// the collection of key/value pairs.
builder.Remove("port");
Expand All @@ -54,9 +47,6 @@ static void Main()
// necessary.
builder["NewKey"] = "newValue";
Console.WriteLine(builder.ConnectionString);

Console.WriteLine("Press Enter to finish.");
Console.ReadLine();
}
}
// </Snippet1>

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading