Skip to content

SFI ROPC: Remove problematic connection strings #11237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 24, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;

Check failure on line 1 in snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.DataSource/CS/source.cs

View workflow job for this annotation

GitHub Actions / snippets-build

ERROR: Project missing. A project (and optionally a solution file) must be in this directory or one of the parent directories to validate and build this code.
using System.Xml;
using System.Data;
using System.Data.Odbc;
Expand All @@ -13,7 +13,7 @@
// <Snippet1>
public void CreateOdbcConnection()
{
string connectionString = "Driver={SQL Native Client};Server=(local);Trusted_Connection=Yes;Database=AdventureWorks;";
string connectionString = "...";

using (OdbcConnection connection = new OdbcConnection(connectionString))
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;

Check failure on line 1 in snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.Database/CS/source.cs

View workflow job for this annotation

GitHub Actions / snippets-build

ERROR: Project missing. A project (and optionally a solution file) must be in this directory or one of the parent directories to validate and build this code.
using System.Collections.Generic;
using System.Text;
using System.Data.Odbc;
Expand All @@ -15,7 +15,7 @@
// <Snippet1>
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))
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;

Check failure on line 1 in snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataAdapter.RowUpdated Example/CS/source.cs

View workflow job for this annotation

GitHub Actions / snippets-build

ERROR: Project missing. A project (and optionally a solution file) must be in this directory or one of the parent directories to validate and build this code.
using System.Xml;
using System.Data;
using System.Data.SqlClient;
Expand All @@ -25,8 +25,7 @@

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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;

Check failure on line 1 in snippets/csharp/VS_Snippets_ADO.NET/DP DataView Samples/CS/Form1.cs

View workflow job for this annotation

GitHub Actions / snippets-build

ERROR: Too many projects found. A single project or solution must exist in this directory or one of the parent directories.
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
Expand Down Expand Up @@ -36,8 +36,7 @@
// 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, " +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Imports System.Xml

Check failure on line 1 in snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataAdapter.RowUpdated Example/VB/source.vb

View workflow job for this annotation

GitHub Actions / snippets-build

ERROR: Project missing. A project (and optionally a solution file) must be in this directory or one of the parent directories to validate and build this code.
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.Common
Expand All @@ -8,67 +8,66 @@
Inherits Form
Private DataSet1 As DataSet
Private dataGrid1 As DataGrid

' <Snippet1>
' 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
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"
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
End Function


Overloads Private Shared Sub PrintEventArgs(args As SqlRowUpdatingEventArgs)
Console.WriteLine("OnRowUpdating")
Console.WriteLine(" event args: (" & " command=" & args.Command.CommandText & _
" commandType=" & args.StatementType & " status=" & args.Status & ")")
End Sub
End Sub


Overloads Private Shared Sub PrintEventArgs(args As SqlRowUpdatedEventArgs)
Console.WriteLine("OnRowUpdated")
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
' </Snippet1>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Option Explicit On

Check failure on line 1 in snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.TryGetValue/VB/source.vb

View workflow job for this annotation

GitHub Actions / snippets-build

ERROR: Project missing. A project (and optionally a solution file) must be in this directory or one of the parent directories to validate and build this code.
Option Strict On

Imports System.Data
Expand All @@ -8,10 +8,7 @@
' <Snippet1>
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.
Expand All @@ -31,7 +28,7 @@
' 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.
' caller.
Try
If builder.TryGetValue(key, value) Then
Console.WriteLine("{0}={1}", key, value)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Option Explicit

Check failure on line 1 in snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder/VB/source.vb

View workflow job for this annotation

GitHub Actions / snippets-build

ERROR: Project missing. A project (and optionally a solution file) must be in this directory or one of the parent directories to validate and build this code.
Option Strict

Imports System.Data
' <Snippet1>
Imports System.Data.OleDb
Imports System.Data.OleDb
Imports System.Collections

Module Module1
Expand All @@ -27,13 +27,10 @@
' 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()
Expand All @@ -42,7 +39,7 @@
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")

Expand All @@ -52,8 +49,8 @@
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"
Expand Down
Loading