diff --git a/snippets/csharp/System.Windows.Controls/DataGrid/SelectedCellsChanged/appsettings.json b/snippets/csharp/System.Windows.Controls/DataGrid/SelectedCellsChanged/appsettings.json
index 30bba331a31..43251fa0309 100644
--- a/snippets/csharp/System.Windows.Controls/DataGrid/SelectedCellsChanged/appsettings.json
+++ b/snippets/csharp/System.Windows.Controls/DataGrid/SelectedCellsChanged/appsettings.json
@@ -1,5 +1,5 @@
{
"ConnectionStrings": {
- "DataGrid_CellSelection.Properties.Settings.AdventureWorksLT2008ConnectionString": "Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=True"
+ "DataGrid_CellSelection.Properties.Settings.AdventureWorksLT2008ConnectionString": "Data Source=.;Initial Catalog=AdventureWorksLT2008;Integrated Security=True"
}
-}
\ No newline at end of file
+}
diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.DataSource/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.DataSource/CS/Project.csproj
new file mode 100644
index 00000000000..5418b105b71
--- /dev/null
+++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.DataSource/CS/Project.csproj
@@ -0,0 +1,12 @@
+
+
+
+ Library
+ net8.0
+
+
+
+
+
+
+
diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.DataSource/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.DataSource/CS/source.cs
index 88a8f6c3de4..32a528faee3 100644
--- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.DataSource/CS/source.cs
+++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.DataSource/CS/source.cs
@@ -1,29 +1,22 @@
using System;
-using System.Xml;
-using System.Data;
using System.Data.Odbc;
-using System.Data.Common;
-using System.Windows.Forms;
-public class Form1: Form
+public class Example
{
- protected DataSet DataSet1;
- protected DataGrid dataGrid1;
+ //
+ public void CreateOdbcConnection()
+ {
+ string connectionString = "...";
-//
- public void CreateOdbcConnection()
- {
- string connectionString = "Driver={SQL Native Client};Server=(local);Trusted_Connection=Yes;Database=AdventureWorks;";
+ using (OdbcConnection connection = new(connectionString))
+ {
+ connection.Open();
+ Console.WriteLine($"ServerVersion: {connection.ServerVersion}"
+ + $"\nDatabase: {connection.Database}");
- using (OdbcConnection connection = new OdbcConnection(connectionString))
- {
- connection.Open();
- Console.WriteLine("ServerVersion: " + connection.ServerVersion
- + "\nDatabase: " + connection.Database);
-
- // The connection is automatically closed at
- // the end of the Using block.
- }
- }
-//
+ // The connection is automatically closed at
+ // the end of the Using block.
+ }
+ }
+ //
}
diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.Database/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.Database/CS/Project.csproj
new file mode 100644
index 00000000000..c387c7762ea
--- /dev/null
+++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.Database/CS/Project.csproj
@@ -0,0 +1,12 @@
+
+
+
+ Library
+ net8.0
+
+
+
+
+
+
+
diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.Database/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.Database/CS/source.cs
index ba9916dab65..b3f375e18a4 100644
--- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.Database/CS/source.cs
+++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.Database/CS/source.cs
@@ -15,7 +15,7 @@ static void Main(string[] args)
//
private static void CreateOdbcConnection()
{
- string connectionString = "Driver={SQL Native Client};Server=(local);Trusted_Connection=Yes;Database=AdventureWorks;";
+ string connectionString = "...";
using (OdbcConnection connection = new OdbcConnection(connectionString))
{
diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataAdapter.RowUpdated Example/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataAdapter.RowUpdated Example/CS/Project.csproj
new file mode 100644
index 00000000000..736c7569449
--- /dev/null
+++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataAdapter.RowUpdated Example/CS/Project.csproj
@@ -0,0 +1,13 @@
+
+
+
+ Exe
+ net8.0-windows
+ true
+
+
+
+
+
+
+
diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataAdapter.RowUpdated Example/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataAdapter.RowUpdated Example/CS/source.cs
index 349b2b0948b..e395d0d8b28 100644
--- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataAdapter.RowUpdated Example/CS/source.cs
+++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataAdapter.RowUpdated Example/CS/source.cs
@@ -1,15 +1,10 @@
using System;
-using System.Xml;
using System.Data;
-using System.Data.SqlClient;
-using System.Data.Common;
using System.Windows.Forms;
+using Microsoft.Data.SqlClient;
-public class Form1: Form
+public class Form1 : Form
{
- private DataSet DataSet1;
- private DataGrid dataGrid1;
-
//
// handler for RowUpdating event
private static void OnRowUpdating(object sender, SqlRowUpdatingEventArgs e)
@@ -25,16 +20,15 @@ private static void OnRowUpdated(object sender, SqlRowUpdatedEventArgs e)
public static int Main()
{
- const string connectionString =
- "Integrated Security=SSPI;database=Northwind;server=MSSQL1";
+ const string connectionString = "...";
const string queryString = "SELECT * FROM Products";
// create DataAdapter
- SqlDataAdapter adapter = new SqlDataAdapter(queryString, connectionString);
- SqlCommandBuilder builder = new SqlCommandBuilder(adapter);
+ SqlDataAdapter adapter = new(queryString, connectionString);
+ SqlCommandBuilder builder = new(adapter);
// Create and fill DataSet (select only first 5 rows)
- DataSet dataSet = new DataSet();
+ DataSet dataSet = new();
adapter.Fill(dataSet, 0, 5, "Table");
// Modify DataSet
@@ -42,23 +36,23 @@ public static int Main()
table.Rows[0][1] = "new product";
// add handlers
- adapter.RowUpdating += new SqlRowUpdatingEventHandler( OnRowUpdating );
- adapter.RowUpdated += new SqlRowUpdatedEventHandler( OnRowUpdated );
+ adapter.RowUpdating += new SqlRowUpdatingEventHandler(OnRowUpdating);
+ adapter.RowUpdated += new SqlRowUpdatedEventHandler(OnRowUpdated);
// update, this operation fires two events
// (RowUpdating/RowUpdated) per changed row
adapter.Update(dataSet, "Table");
// remove handlers
- adapter.RowUpdating -= new SqlRowUpdatingEventHandler( OnRowUpdating );
- adapter.RowUpdated -= new SqlRowUpdatedEventHandler( OnRowUpdated );
+ adapter.RowUpdating -= new SqlRowUpdatingEventHandler(OnRowUpdating);
+ adapter.RowUpdated -= new SqlRowUpdatedEventHandler(OnRowUpdated);
return 0;
}
private static void PrintEventArgs(SqlRowUpdatingEventArgs args)
{
Console.WriteLine("OnRowUpdating");
- Console.WriteLine(" event args: ("+
+ Console.WriteLine(" event args: (" +
" command=" + args.Command +
" commandType=" + args.StatementType +
" status=" + args.Status + ")");
@@ -67,7 +61,7 @@ private static void PrintEventArgs(SqlRowUpdatingEventArgs args)
private static void PrintEventArgs(SqlRowUpdatedEventArgs args)
{
Console.WriteLine("OnRowUpdated");
- Console.WriteLine( " event args: ("+
+ Console.WriteLine(" event args: (" +
" command=" + args.Command +
" commandType=" + args.StatementType +
" recordsAffected=" + args.RecordsAffected +
diff --git a/snippets/csharp/VS_Snippets_ADO.NET/DP DataView Samples/CS/DataViewSamples.csproj b/snippets/csharp/VS_Snippets_ADO.NET/DP DataView Samples/CS/DataViewSamples.csproj
index b32ac1499e6..c0482b38880 100644
--- a/snippets/csharp/VS_Snippets_ADO.NET/DP DataView Samples/CS/DataViewSamples.csproj
+++ b/snippets/csharp/VS_Snippets_ADO.NET/DP DataView Samples/CS/DataViewSamples.csproj
@@ -1,91 +1,13 @@
-
-
+
+
- Debug
- AnyCPU
- 9.0.20612
- 2.0
- {F2593E93-91A2-4F64-88A4-7E3861B3FE01}
- WinExe
- Properties
- DataViewSamples
- DataViewSamples
- v3.5
- 512
- true
+ Exe
+ net8.0-windows
+ true
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
-
- 3.5
-
-
- 3.5
-
-
- 3.5
-
-
-
-
-
-
-
+
-
- Form
-
-
- Form1.cs
-
-
-
-
- Designer
- Form1.cs
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
- Designer
-
-
- True
- Resources.resx
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
-
- True
- Settings.settings
- True
-
+
-
-
-
\ No newline at end of file
+
+
diff --git a/snippets/csharp/VS_Snippets_ADO.NET/DP DataView Samples/CS/DataViewSamplesCS.csproj b/snippets/csharp/VS_Snippets_ADO.NET/DP DataView Samples/CS/DataViewSamplesCS.csproj
deleted file mode 100644
index 89ad50872b7..00000000000
--- a/snippets/csharp/VS_Snippets_ADO.NET/DP DataView Samples/CS/DataViewSamplesCS.csproj
+++ /dev/null
@@ -1,90 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 9.0.20829
- 2.0
- {C7DFE5E9-7E64-4A23-B0A2-82FE7F862CCF}
- WinExe
- Properties
- DataViewSamplesCS
- DataViewSamplesCS
- v3.5
- 512
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
-
- 3.5
-
-
- 3.5
-
-
- 3.5
-
-
-
-
-
-
-
-
-
- Form
-
-
- Form1.cs
-
-
-
-
- Form1.cs
- Designer
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
- Designer
-
-
- True
- Resources.resx
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
-
- True
- Settings.settings
- True
-
-
-
-
-
\ No newline at end of file
diff --git a/snippets/csharp/VS_Snippets_ADO.NET/DP DataView Samples/CS/Form1.cs b/snippets/csharp/VS_Snippets_ADO.NET/DP DataView Samples/CS/Form1.cs
index 274b305f410..f2ca5ca4489 100644
--- a/snippets/csharp/VS_Snippets_ADO.NET/DP DataView Samples/CS/Form1.cs
+++ b/snippets/csharp/VS_Snippets_ADO.NET/DP DataView Samples/CS/Form1.cs
@@ -1,14 +1,11 @@
using System;
using System.Collections.Generic;
-using System.ComponentModel;
using System.Data;
-using System.Data.SqlClient;
-using System.Data.Common;
-using System.Drawing;
+using System.Globalization;
using System.Linq;
using System.Text;
using System.Windows.Forms;
-using System.Globalization;
+using Microsoft.Data.SqlClient;
namespace DataViewSamples
{
@@ -36,8 +33,7 @@ private void FillDataSet(DataSet ds)
// Create a new adapter and give it a query to fetch sales order, contact,
// address, and product information for sales in the year 2002. Point connection
// information to the configuration setting "AdventureWorks".
- string connectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;"
- + "Integrated Security=true;";
+ string connectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;Integrated Security=true;";
SqlDataAdapter da = new SqlDataAdapter(
"SELECT SalesOrderID, ContactID, OrderDate, OnlineOrderFlag, " +
@@ -85,14 +81,14 @@ private void FillDataSet(DataSet ds)
// Add data relations.
DataTable orderHeader = ds.Tables["SalesOrderHeader"];
DataTable orderDetail = ds.Tables["SalesOrderDetail"];
- DataRelation order = new DataRelation("SalesOrderHeaderDetail",
+ DataRelation order = new("SalesOrderHeaderDetail",
orderHeader.Columns["SalesOrderID"],
orderDetail.Columns["SalesOrderID"], true);
ds.Relations.Add(order);
DataTable contact = ds.Tables["Contact"];
DataTable orderHeader2 = ds.Tables["SalesOrderHeader"];
- DataRelation orderContact = new DataRelation("SalesOrderContact",
+ DataRelation orderContact = new("SalesOrderContact",
contact.Columns["ContactID"],
orderHeader2.Columns["ContactID"], true);
ds.Relations.Add(orderContact);
@@ -114,14 +110,16 @@ static private string SoundEx(string word)
if (size > 1)
{
// Convert the word to uppercase characters.
- word = word.ToUpper(System.Globalization.CultureInfo.InvariantCulture);
+ word = word.ToUpper(CultureInfo.InvariantCulture);
// Convert the word to a character array.
char[] chars = word.ToCharArray();
// Buffer to hold the character codes.
- StringBuilder buffer = new StringBuilder();
- buffer.Length = 0;
+ StringBuilder buffer = new()
+ {
+ Length = 0
+ };
// The current and previous character codes.
int prevCode = 0;
@@ -228,8 +226,8 @@ private void button2_Click(object sender, EventArgs e)
EnumerableRowCollection query =
from order in orders.AsEnumerable()
- where (order.Field("OrderQty") > 2 &&
- order.Field("OrderQty") < 6)
+ where (order.Field("OrderQty") > 2 &&
+ order.Field("OrderQty") < 6)
select order;
DataView view = query.AsDataView();
@@ -472,7 +470,7 @@ where contact.Field("LastName") == "Hernandez"
bindingSource1.DataSource = view;
dataGridView1.AutoResizeColumns();
- //
+ //
}
private void button18_Click(object sender, EventArgs e)
@@ -553,7 +551,7 @@ orderby product.Field("ListPrice"), product.Field("Color")
view.Sort = "Color";
- object[] criteria = new object[] { "Red"};
+ object[] criteria = new object[] { "Red" };
DataRowView[] foundRowsView = view.FindRows(criteria);
//
@@ -649,15 +647,18 @@ orderby product.Field("ListPrice")
DataTable productsTable = (DataTable)view.Table;
// Set RowStateFilter to display the current rows.
- view.RowStateFilter = DataViewRowState.CurrentRows ;
+ view.RowStateFilter = DataViewRowState.CurrentRows;
// Query the DataView for red colored products ordered by list price.
var productQuery = from DataRowView rowView in view
where rowView.Row.Field("Color") == "Red"
orderby rowView.Row.Field("ListPrice")
- select new { Name = rowView.Row.Field("Name"),
- Color = rowView.Row.Field("Color"),
- Price = rowView.Row.Field("ListPrice")};
+ select new
+ {
+ Name = rowView.Row.Field("Name"),
+ Color = rowView.Row.Field("Color"),
+ Price = rowView.Row.Field("ListPrice")
+ };
// Bind the query results to another DataGridView.
dataGridView2.DataSource = productQuery.ToList();
diff --git a/snippets/csharp/VS_Snippets_ADO.NET/DP DataView Samples/CS/Properties/AssemblyInfo.cs b/snippets/csharp/VS_Snippets_ADO.NET/DP DataView Samples/CS/Properties/AssemblyInfo.cs
deleted file mode 100644
index 0e9024f7d3d..00000000000
--- a/snippets/csharp/VS_Snippets_ADO.NET/DP DataView Samples/CS/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("DataViewSamples")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("msft")]
-[assembly: AssemblyProduct("DataViewSamples")]
-[assembly: AssemblyCopyright("Copyright © msft 2007")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("28b1f348-f287-4de5-a981-772021517503")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataAdapter.RowUpdated Example/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataAdapter.RowUpdated Example/VB/Project.vbproj
new file mode 100644
index 00000000000..736c7569449
--- /dev/null
+++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataAdapter.RowUpdated Example/VB/Project.vbproj
@@ -0,0 +1,13 @@
+
+
+
+ Exe
+ net8.0-windows
+ true
+
+
+
+
+
+
+
diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataAdapter.RowUpdated Example/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataAdapter.RowUpdated Example/VB/source.vb
index 69d7272340d..0cdada9f756 100644
--- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataAdapter.RowUpdated Example/VB/source.vb
+++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataAdapter.RowUpdated Example/VB/source.vb
@@ -1,74 +1,64 @@
-Imports System.Xml
-Imports System.Data
-Imports System.Data.SqlClient
-Imports System.Data.Common
+Imports System.Data
Imports System.Windows.Forms
+Imports Microsoft.Data.SqlClient
Public Class Form1
Inherits Form
- Private DataSet1 As DataSet
- Private dataGrid1 As DataGrid
-
+
'
' handler for RowUpdating event
Private Shared Sub OnRowUpdating(sender As Object, e As SqlRowUpdatingEventArgs)
PrintEventArgs(e)
- End Sub
+ End Sub
' handler for RowUpdated event
Private Shared Sub OnRowUpdated(sender As Object, e As SqlRowUpdatedEventArgs)
PrintEventArgs(e)
- End Sub
-
- 'Entry point which delegates to C-style main Private Function
- Public Overloads Shared Sub Main()
- System.Environment.ExitCode = Main(System.Environment.GetCommandLineArgs())
End Sub
-
- Overloads Public Shared Function Main(args() As String) As Integer
- Const connectionString As String = _
- "Integrated Security=SSPI;database=Northwind;server=MSSQL1"
+
+ Public Overloads Shared Function Main(args() As String) As Integer
+ Const connectionString As String = "..."
Const queryString As String = "SELECT * FROM Products"
-
+
' create DataAdapter
Dim adapter As New SqlDataAdapter(queryString, connectionString)
Dim builder As New SqlCommandBuilder(adapter)
-
+
' Create and fill DataSet (select only first 5 rows)
Dim dataSet As New DataSet()
adapter.Fill(dataSet, 0, 5, "Table")
-
+
' Modify DataSet
Dim table As DataTable = dataSet.Tables("Table")
table.Rows(0)(1) = "new product"
-
+
' add handlers
AddHandler adapter.RowUpdating, AddressOf OnRowUpdating
AddHandler adapter.RowUpdated, AddressOf OnRowUpdated
-
- ' update, this operation fires two events
- '(RowUpdating/RowUpdated) per changed row
+
+ ' update, this operation fires two events
+ '(RowUpdating/RowUpdated) per changed row
adapter.Update(dataSet, "Table")
-
+
' remove handlers
RemoveHandler adapter.RowUpdating, AddressOf OnRowUpdating
RemoveHandler adapter.RowUpdated, AddressOf OnRowUpdated
Return 0
- End Function
-
-
- Overloads Private Shared Sub PrintEventArgs(args As SqlRowUpdatingEventArgs)
+ End Function
+
+
+ Private Overloads Shared Sub PrintEventArgs(args As SqlRowUpdatingEventArgs)
Console.WriteLine("OnRowUpdating")
- Console.WriteLine(" event args: (" & " command=" & args.Command.CommandText & _
+ Console.WriteLine(" event args: (" & " command=" & args.Command.CommandText &
" commandType=" & args.StatementType & " status=" & args.Status & ")")
- End Sub
-
-
- Overloads Private Shared Sub PrintEventArgs(args As SqlRowUpdatedEventArgs)
+ End Sub
+
+
+ Private Overloads Shared Sub PrintEventArgs(args As SqlRowUpdatedEventArgs)
Console.WriteLine("OnRowUpdated")
- Console.WriteLine(" event args: (" & " command=" & args.Command.CommandText & _
- " commandType=" & args.StatementType & " recordsAffected=" & _
+ Console.WriteLine(" event args: (" & " command=" & args.Command.CommandText &
+ " commandType=" & args.StatementType & " recordsAffected=" &
args.RecordsAffected & " status=" & args.Status & ")")
- End Sub
-End Class
+ End Sub
+End Class
'
diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.TryGetValue/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.TryGetValue/VB/Project.vbproj
new file mode 100644
index 00000000000..706cd0177f4
--- /dev/null
+++ b/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.TryGetValue/VB/Project.vbproj
@@ -0,0 +1,8 @@
+
+
+
+ Library
+ net4.8
+
+
+
diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.TryGetValue/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.TryGetValue/VB/source.vb
index 95d018a8fb1..bfe970f03d1 100644
--- a/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.TryGetValue/VB/source.vb
+++ b/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.TryGetValue/VB/source.vb
@@ -8,13 +8,9 @@ Module Module1
'
Sub Main()
Dim builder As New DbConnectionStringBuilder
- builder.ConnectionString = _
- "Provider=sqloledb;Data Source=192.168.168.1,1433;" & _
- "Network Library=DBMSSOCN;Initial Catalog=pubs;" & _
- "Integrated Security=SSPI;"
+ builder.ConnectionString = "..."
- ' Call TryGetValue method for multiple
- ' key names.
+ ' Call TryGetValue method for multiple key names.
DisplayValue(builder, "Provider")
DisplayValue(builder, "DATA SOURCE")
DisplayValue(builder, "InvalidKey")
@@ -30,8 +26,7 @@ Module Module1
' Although TryGetValue handles missing keys,
' it doesn't handle passing in a null (Nothing in Visual Basic)
' key. This example traps for that particular error, but
- ' bubbles any other unknown exceptions back out to the
- ' caller.
+ ' bubbles any other unknown exceptions back out to the caller.
Try
If builder.TryGetValue(key, value) Then
Console.WriteLine("{0}={1}", key, value)
diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder/VB/Project.vbproj
new file mode 100644
index 00000000000..0b364f79042
--- /dev/null
+++ b/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder/VB/Project.vbproj
@@ -0,0 +1,12 @@
+
+
+
+ Library
+ net8.0
+
+
+
+
+
+
+
diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder/VB/source.vb
index cf43e3a76d0..df7cd9df0df 100644
--- a/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder/VB/source.vb
+++ b/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder/VB/source.vb
@@ -3,7 +3,7 @@ Option Strict
Imports System.Data
'
-Imports System.Data.OleDb
+Imports System.Data.OleDb
Imports System.Collections
Module Module1
@@ -27,13 +27,10 @@ Module Module1
' default values.
builder.Clear()
- ' Pass the OleDbConnectionStringBuilder an existing
+ ' Pass the OleDbConnectionStringBuilder an existing
' connection string, and you can retrieve and
' modify any of the elements.
- builder.ConnectionString = _
- "Provider=DB2OLEDB;Network Transport Library=TCPIP;" & _
- "Network Address=192.168.0.12;Initial Catalog=DbAdventures;" & _
- "Package Collection=SamplePackage;Default Schema=SampleSchema;"
+ builder.ConnectionString = "..."
Console.WriteLine("Network Address = " & builder("Network Address").ToString())
Console.WriteLine()
@@ -42,7 +39,7 @@ Module Module1
builder("Package Collection") = "NewPackage"
builder("Default Schema") = "NewSchema"
- ' Call the Remove method to remove items from
+ ' Call the Remove method to remove items from
' the collection of key/value pairs.
builder.Remove("User ID")
@@ -52,8 +49,8 @@ Module Module1
Console.WriteLine(builder.ConnectionString)
Console.WriteLine()
- ' The Item property is the default for the class,
- ' and setting the Item property adds the value, if
+ ' The Item property is the default for the class,
+ ' and setting the Item property adds the value, if
' necessary.
builder("User ID") = "SampleUser"
builder("Password") = "SamplePassword"