Skip to content

Commit 7794853

Browse files
committed
remove problematic connection strings
1 parent 75d0922 commit 7794853

File tree

8 files changed

+36
-45
lines changed
  • snippets
    • csharp
      • System.Windows.Controls/DataGrid/SelectedCellsChanged
      • VS_Snippets_ADO.NET
        • Classic WebData OdbcConnection.DataSource/CS
        • Classic WebData OdbcConnection.Database/CS
        • Classic WebData SqlDataAdapter.RowUpdated Example/CS
        • DP DataView Samples/CS
    • visualbasic/VS_Snippets_ADO.NET
      • Classic WebData SqlDataAdapter.RowUpdated Example/VB
      • DataWorks DbConnectionStringBuilder.TryGetValue/VB
      • DataWorks OleDbConnectionStringBuilder/VB

8 files changed

+36
-45
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"ConnectionStrings": {
3-
"DataGrid_CellSelection.Properties.Settings.AdventureWorksLT2008ConnectionString": "Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=True"
3+
"DataGrid_CellSelection.Properties.Settings.AdventureWorksLT2008ConnectionString": "Data Source=.;Initial Catalog=AdventureWorksLT2008;Integrated Security=True"
44
}
5-
}
5+
}

snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.DataSource/CS/source.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class Form1: Form
1313
// <Snippet1>
1414
public void CreateOdbcConnection()
1515
{
16-
string connectionString = "Driver={SQL Native Client};Server=(local);Trusted_Connection=Yes;Database=AdventureWorks;";
16+
string connectionString = "...";
1717

1818
using (OdbcConnection connection = new OdbcConnection(connectionString))
1919
{

snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.Database/CS/source.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ static void Main(string[] args)
1515
// <Snippet1>
1616
private static void CreateOdbcConnection()
1717
{
18-
string connectionString = "Driver={SQL Native Client};Server=(local);Trusted_Connection=Yes;Database=AdventureWorks;";
18+
string connectionString = "...";
1919

2020
using (OdbcConnection connection = new OdbcConnection(connectionString))
2121
{

snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataAdapter.RowUpdated Example/CS/source.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ private static void OnRowUpdated(object sender, SqlRowUpdatedEventArgs e)
2525

2626
public static int Main()
2727
{
28-
const string connectionString =
29-
"Integrated Security=SSPI;database=Northwind;server=MSSQL1";
28+
const string connectionString = "...";
3029
const string queryString = "SELECT * FROM Products";
3130

3231
// create DataAdapter

snippets/csharp/VS_Snippets_ADO.NET/DP DataView Samples/CS/Form1.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ private void FillDataSet(DataSet ds)
3636
// Create a new adapter and give it a query to fetch sales order, contact,
3737
// address, and product information for sales in the year 2002. Point connection
3838
// information to the configuration setting "AdventureWorks".
39-
string connectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;"
40-
+ "Integrated Security=true;";
39+
string connectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;Integrated Security=true;";
4140

4241
SqlDataAdapter da = new SqlDataAdapter(
4342
"SELECT SalesOrderID, ContactID, OrderDate, OnlineOrderFlag, " +

snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataAdapter.RowUpdated Example/VB/source.vb

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,67 +8,66 @@ Public Class Form1
88
Inherits Form
99
Private DataSet1 As DataSet
1010
Private dataGrid1 As DataGrid
11-
11+
1212
' <Snippet1>
1313
' handler for RowUpdating event
1414
Private Shared Sub OnRowUpdating(sender As Object, e As SqlRowUpdatingEventArgs)
1515
PrintEventArgs(e)
16-
End Sub
16+
End Sub
1717

1818
' handler for RowUpdated event
1919
Private Shared Sub OnRowUpdated(sender As Object, e As SqlRowUpdatedEventArgs)
2020
PrintEventArgs(e)
21-
End Sub
22-
21+
End Sub
22+
2323
'Entry point which delegates to C-style main Private Function
2424
Public Overloads Shared Sub Main()
2525
System.Environment.ExitCode = Main(System.Environment.GetCommandLineArgs())
2626
End Sub
27-
27+
2828
Overloads Public Shared Function Main(args() As String) As Integer
29-
Const connectionString As String = _
30-
"Integrated Security=SSPI;database=Northwind;server=MSSQL1"
29+
Const connectionString As String = "..."
3130
Const queryString As String = "SELECT * FROM Products"
32-
31+
3332
' create DataAdapter
3433
Dim adapter As New SqlDataAdapter(queryString, connectionString)
3534
Dim builder As New SqlCommandBuilder(adapter)
36-
35+
3736
' Create and fill DataSet (select only first 5 rows)
3837
Dim dataSet As New DataSet()
3938
adapter.Fill(dataSet, 0, 5, "Table")
40-
39+
4140
' Modify DataSet
4241
Dim table As DataTable = dataSet.Tables("Table")
4342
table.Rows(0)(1) = "new product"
44-
43+
4544
' add handlers
4645
AddHandler adapter.RowUpdating, AddressOf OnRowUpdating
4746
AddHandler adapter.RowUpdated, AddressOf OnRowUpdated
48-
49-
' update, this operation fires two events
50-
'(RowUpdating/RowUpdated) per changed row
47+
48+
' update, this operation fires two events
49+
'(RowUpdating/RowUpdated) per changed row
5150
adapter.Update(dataSet, "Table")
52-
51+
5352
' remove handlers
5453
RemoveHandler adapter.RowUpdating, AddressOf OnRowUpdating
5554
RemoveHandler adapter.RowUpdated, AddressOf OnRowUpdated
5655
Return 0
57-
End Function
58-
59-
56+
End Function
57+
58+
6059
Overloads Private Shared Sub PrintEventArgs(args As SqlRowUpdatingEventArgs)
6160
Console.WriteLine("OnRowUpdating")
6261
Console.WriteLine(" event args: (" & " command=" & args.Command.CommandText & _
6362
" commandType=" & args.StatementType & " status=" & args.Status & ")")
64-
End Sub
65-
66-
63+
End Sub
64+
65+
6766
Overloads Private Shared Sub PrintEventArgs(args As SqlRowUpdatedEventArgs)
6867
Console.WriteLine("OnRowUpdated")
6968
Console.WriteLine(" event args: (" & " command=" & args.Command.CommandText & _
7069
" commandType=" & args.StatementType & " recordsAffected=" & _
7170
args.RecordsAffected & " status=" & args.Status & ")")
72-
End Sub
73-
End Class
71+
End Sub
72+
End Class
7473
' </Snippet1>

snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.TryGetValue/VB/source.vb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ Module Module1
88
' <Snippet1>
99
Sub Main()
1010
Dim builder As New DbConnectionStringBuilder
11-
builder.ConnectionString = _
12-
"Provider=sqloledb;Data Source=192.168.168.1,1433;" & _
13-
"Network Library=DBMSSOCN;Initial Catalog=pubs;" & _
14-
"Integrated Security=SSPI;"
11+
builder.ConnectionString = "..."
1512

1613
' Call TryGetValue method for multiple
1714
' key names.
@@ -31,7 +28,7 @@ Module Module1
3128
' it doesn't handle passing in a null (Nothing in Visual Basic)
3229
' key. This example traps for that particular error, but
3330
' bubbles any other unknown exceptions back out to the
34-
' caller.
31+
' caller.
3532
Try
3633
If builder.TryGetValue(key, value) Then
3734
Console.WriteLine("{0}={1}", key, value)

snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder/VB/source.vb

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Option Strict
33

44
Imports System.Data
55
' <Snippet1>
6-
Imports System.Data.OleDb
6+
Imports System.Data.OleDb
77
Imports System.Collections
88

99
Module Module1
@@ -27,13 +27,10 @@ Module Module1
2727
' default values.
2828
builder.Clear()
2929

30-
' Pass the OleDbConnectionStringBuilder an existing
30+
' Pass the OleDbConnectionStringBuilder an existing
3131
' connection string, and you can retrieve and
3232
' modify any of the elements.
33-
builder.ConnectionString = _
34-
"Provider=DB2OLEDB;Network Transport Library=TCPIP;" & _
35-
"Network Address=192.168.0.12;Initial Catalog=DbAdventures;" & _
36-
"Package Collection=SamplePackage;Default Schema=SampleSchema;"
33+
builder.ConnectionString = "..."
3734

3835
Console.WriteLine("Network Address = " & builder("Network Address").ToString())
3936
Console.WriteLine()
@@ -42,7 +39,7 @@ Module Module1
4239
builder("Package Collection") = "NewPackage"
4340
builder("Default Schema") = "NewSchema"
4441

45-
' Call the Remove method to remove items from
42+
' Call the Remove method to remove items from
4643
' the collection of key/value pairs.
4744
builder.Remove("User ID")
4845

@@ -52,8 +49,8 @@ Module Module1
5249
Console.WriteLine(builder.ConnectionString)
5350
Console.WriteLine()
5451

55-
' The Item property is the default for the class,
56-
' and setting the Item property adds the value, if
52+
' The Item property is the default for the class,
53+
' and setting the Item property adds the value, if
5754
' necessary.
5855
builder("User ID") = "SampleUser"
5956
builder("Password") = "SamplePassword"

0 commit comments

Comments
 (0)