From 4b60f2ce585ce40a3c80bff841a2f5b6efeea360 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Tue, 1 Oct 2024 07:53:38 -0700 Subject: [PATCH 1/7] replace alias with 'localhost' (#10474) --- .../DataGrid/AutoGenerateColumns/app.config | 4 +-- .../properties/settings.designer.cs | 30 +++++++++++-------- .../properties/settings.settings | 6 ++-- .../DataGrid/Columns/app.config | 4 +-- .../Columns/properties/settings.designer.cs | 30 +++++++++++-------- .../Columns/properties/settings.settings | 6 ++-- .../DataGrid/FrozenColumnCount/app.config | 4 +-- .../properties/settings.designer.cs | 30 +++++++++++-------- .../properties/settings.settings | 6 ++-- .../DataGrid/Overview/app.config | 2 +- .../Overview/properties/settings.designer.cs | 30 +++++++++++-------- .../Overview/properties/settings.settings | 6 ++-- .../DataGrid/RowHeaderStyle/app.config | 4 +-- .../properties/settings.designer.cs | 30 +++++++++++-------- .../properties/settings.settings | 6 ++-- .../DataGrid/SelectedCellsChanged/app.config | 4 +-- .../properties/settings.designer.cs | 30 +++++++++++-------- .../properties/settings.settings | 6 ++-- .../Overview/app.config | 4 +-- .../Overview/properties/settings.designer.cs | 30 +++++++++++-------- .../Overview/properties/settings.settings | 6 ++-- .../VS_Snippets_Wpf/datagrid1/vb/app.config | 2 +- .../datagrid1/vb/my project/settings.settings | 6 ++-- .../vb/datagrid_autogencolumns_vb/app.config | 2 +- .../my project/settings.settings | 6 ++-- .../vb/datagrid_cellselection_vb/app.config | 2 +- .../my project/settings.settings | 6 ++-- .../app.config | 2 +- .../my project/settings.settings | 6 ++-- .../datagrid_customcolumns/vb/app.config | 2 +- .../vb/my project/settings.settings | 6 ++-- .../datagrid_frozencolumn/vb/app.config | 2 +- .../vb/my project/settings.settings | 6 ++-- .../vb/datagrid_rowheader_vb/app.config | 2 +- .../my project/settings.settings | 6 ++-- 35 files changed, 188 insertions(+), 146 deletions(-) diff --git a/snippets/csharp/System.Windows.Controls/DataGrid/AutoGenerateColumns/app.config b/snippets/csharp/System.Windows.Controls/DataGrid/AutoGenerateColumns/app.config index aaea48f8325..170f6537a49 100644 --- a/snippets/csharp/System.Windows.Controls/DataGrid/AutoGenerateColumns/app.config +++ b/snippets/csharp/System.Windows.Controls/DataGrid/AutoGenerateColumns/app.config @@ -4,7 +4,7 @@ - \ No newline at end of file + diff --git a/snippets/csharp/System.Windows.Controls/DataGrid/AutoGenerateColumns/properties/settings.designer.cs b/snippets/csharp/System.Windows.Controls/DataGrid/AutoGenerateColumns/properties/settings.designer.cs index 9fedbb73881..4c49e2392ec 100644 --- a/snippets/csharp/System.Windows.Controls/DataGrid/AutoGenerateColumns/properties/settings.designer.cs +++ b/snippets/csharp/System.Windows.Controls/DataGrid/AutoGenerateColumns/properties/settings.designer.cs @@ -8,28 +8,34 @@ // //------------------------------------------------------------------------------ -namespace DataGrid_AutoGenColumns.Properties { - - +namespace DataGrid_AutoGenColumns.Properties +{ + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { + + public static Settings Default + { + get + { return defaultInstance; } } - + [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)] - [global::System.Configuration.DefaultSettingValueAttribute("Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=Tr" + + [global::System.Configuration.DefaultSettingValueAttribute("Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=Tr" + "ue")] - public string AdventureWorksLT2008ConnectionString { - get { + public string AdventureWorksLT2008ConnectionString + { + get + { return ((string)(this["AdventureWorksLT2008ConnectionString"])); } } diff --git a/snippets/csharp/System.Windows.Controls/DataGrid/AutoGenerateColumns/properties/settings.settings b/snippets/csharp/System.Windows.Controls/DataGrid/AutoGenerateColumns/properties/settings.settings index a716324d20f..5b06e7adede 100644 --- a/snippets/csharp/System.Windows.Controls/DataGrid/AutoGenerateColumns/properties/settings.settings +++ b/snippets/csharp/System.Windows.Controls/DataGrid/AutoGenerateColumns/properties/settings.settings @@ -5,10 +5,10 @@ <?xml version="1.0" encoding="utf-16"?> <SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - <ConnectionString>Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=True</ConnectionString> + <ConnectionString>Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=True</ConnectionString> <ProviderName>System.Data.SqlClient</ProviderName> </SerializableConnectionString> - Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=True + Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=True - \ No newline at end of file + diff --git a/snippets/csharp/System.Windows.Controls/DataGrid/Columns/app.config b/snippets/csharp/System.Windows.Controls/DataGrid/Columns/app.config index 3d8ccc034c3..f86f4ddc658 100644 --- a/snippets/csharp/System.Windows.Controls/DataGrid/Columns/app.config +++ b/snippets/csharp/System.Windows.Controls/DataGrid/Columns/app.config @@ -4,7 +4,7 @@ - \ No newline at end of file + diff --git a/snippets/csharp/System.Windows.Controls/DataGrid/Columns/properties/settings.designer.cs b/snippets/csharp/System.Windows.Controls/DataGrid/Columns/properties/settings.designer.cs index 80056b432a8..50be8dc7f8a 100644 --- a/snippets/csharp/System.Windows.Controls/DataGrid/Columns/properties/settings.designer.cs +++ b/snippets/csharp/System.Windows.Controls/DataGrid/Columns/properties/settings.designer.cs @@ -8,28 +8,34 @@ // //------------------------------------------------------------------------------ -namespace DataGrid_ColumnsManipulation.Properties { - - +namespace DataGrid_ColumnsManipulation.Properties +{ + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { + + public static Settings Default + { + get + { return defaultInstance; } } - + [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)] - [global::System.Configuration.DefaultSettingValueAttribute("Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=Tr" + + [global::System.Configuration.DefaultSettingValueAttribute("Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=Tr" + "ue")] - public string AdventureWorksLT2008ConnectionString { - get { + public string AdventureWorksLT2008ConnectionString + { + get + { return ((string)(this["AdventureWorksLT2008ConnectionString"])); } } diff --git a/snippets/csharp/System.Windows.Controls/DataGrid/Columns/properties/settings.settings b/snippets/csharp/System.Windows.Controls/DataGrid/Columns/properties/settings.settings index 44c2c68d853..6004be9a19d 100644 --- a/snippets/csharp/System.Windows.Controls/DataGrid/Columns/properties/settings.settings +++ b/snippets/csharp/System.Windows.Controls/DataGrid/Columns/properties/settings.settings @@ -5,10 +5,10 @@ <?xml version="1.0" encoding="utf-16"?> <SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - <ConnectionString>Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=True</ConnectionString> + <ConnectionString>Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=True</ConnectionString> <ProviderName>System.Data.SqlClient</ProviderName> </SerializableConnectionString> - Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=True + Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=True - \ No newline at end of file + diff --git a/snippets/csharp/System.Windows.Controls/DataGrid/FrozenColumnCount/app.config b/snippets/csharp/System.Windows.Controls/DataGrid/FrozenColumnCount/app.config index 97c9267e14e..7dea2aa19b2 100644 --- a/snippets/csharp/System.Windows.Controls/DataGrid/FrozenColumnCount/app.config +++ b/snippets/csharp/System.Windows.Controls/DataGrid/FrozenColumnCount/app.config @@ -4,7 +4,7 @@ - \ No newline at end of file + diff --git a/snippets/csharp/System.Windows.Controls/DataGrid/FrozenColumnCount/properties/settings.designer.cs b/snippets/csharp/System.Windows.Controls/DataGrid/FrozenColumnCount/properties/settings.designer.cs index 170c2b876bb..c67a13205e9 100644 --- a/snippets/csharp/System.Windows.Controls/DataGrid/FrozenColumnCount/properties/settings.designer.cs +++ b/snippets/csharp/System.Windows.Controls/DataGrid/FrozenColumnCount/properties/settings.designer.cs @@ -8,28 +8,34 @@ // //------------------------------------------------------------------------------ -namespace DataGrid_FrozenColumns.Properties { - - +namespace DataGrid_FrozenColumns.Properties +{ + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { + + public static Settings Default + { + get + { return defaultInstance; } } - + [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)] - [global::System.Configuration.DefaultSettingValueAttribute("Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=Tr" + + [global::System.Configuration.DefaultSettingValueAttribute("Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=Tr" + "ue")] - public string AdventureWorksLT2008ConnectionString { - get { + public string AdventureWorksLT2008ConnectionString + { + get + { return ((string)(this["AdventureWorksLT2008ConnectionString"])); } } diff --git a/snippets/csharp/System.Windows.Controls/DataGrid/FrozenColumnCount/properties/settings.settings b/snippets/csharp/System.Windows.Controls/DataGrid/FrozenColumnCount/properties/settings.settings index 51a01adccc7..aebb0349d97 100644 --- a/snippets/csharp/System.Windows.Controls/DataGrid/FrozenColumnCount/properties/settings.settings +++ b/snippets/csharp/System.Windows.Controls/DataGrid/FrozenColumnCount/properties/settings.settings @@ -5,10 +5,10 @@ <?xml version="1.0" encoding="utf-16"?> <SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - <ConnectionString>Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=True</ConnectionString> + <ConnectionString>Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=True</ConnectionString> <ProviderName>System.Data.SqlClient</ProviderName> </SerializableConnectionString> - Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=True + Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=True - \ No newline at end of file + diff --git a/snippets/csharp/System.Windows.Controls/DataGrid/Overview/app.config b/snippets/csharp/System.Windows.Controls/DataGrid/Overview/app.config index b7aebb16375..da2aab3ebe6 100644 --- a/snippets/csharp/System.Windows.Controls/DataGrid/Overview/app.config +++ b/snippets/csharp/System.Windows.Controls/DataGrid/Overview/app.config @@ -4,7 +4,7 @@ diff --git a/snippets/csharp/System.Windows.Controls/DataGrid/Overview/properties/settings.designer.cs b/snippets/csharp/System.Windows.Controls/DataGrid/Overview/properties/settings.designer.cs index f330cc2e4cc..6a982d5b3eb 100644 --- a/snippets/csharp/System.Windows.Controls/DataGrid/Overview/properties/settings.designer.cs +++ b/snippets/csharp/System.Windows.Controls/DataGrid/Overview/properties/settings.designer.cs @@ -8,28 +8,34 @@ // //------------------------------------------------------------------------------ -namespace DataGrid1.Properties { - - +namespace DataGrid1.Properties +{ + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { + + public static Settings Default + { + get + { return defaultInstance; } } - + [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)] - [global::System.Configuration.DefaultSettingValueAttribute("Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=Tr" + + [global::System.Configuration.DefaultSettingValueAttribute("Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=Tr" + "ue")] - public string AdventureWorksLT2008ConnectionString { - get { + public string AdventureWorksLT2008ConnectionString + { + get + { return ((string)(this["AdventureWorksLT2008ConnectionString"])); } } diff --git a/snippets/csharp/System.Windows.Controls/DataGrid/Overview/properties/settings.settings b/snippets/csharp/System.Windows.Controls/DataGrid/Overview/properties/settings.settings index cb9a5838776..12062b2d747 100644 --- a/snippets/csharp/System.Windows.Controls/DataGrid/Overview/properties/settings.settings +++ b/snippets/csharp/System.Windows.Controls/DataGrid/Overview/properties/settings.settings @@ -5,10 +5,10 @@ <?xml version="1.0" encoding="utf-16"?> <SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - <ConnectionString>Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=True</ConnectionString> + <ConnectionString>Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=True</ConnectionString> <ProviderName>System.Data.SqlClient</ProviderName> </SerializableConnectionString> - Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=True + Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=True - \ No newline at end of file + diff --git a/snippets/csharp/System.Windows.Controls/DataGrid/RowHeaderStyle/app.config b/snippets/csharp/System.Windows.Controls/DataGrid/RowHeaderStyle/app.config index 9ba7696d169..5253477010c 100644 --- a/snippets/csharp/System.Windows.Controls/DataGrid/RowHeaderStyle/app.config +++ b/snippets/csharp/System.Windows.Controls/DataGrid/RowHeaderStyle/app.config @@ -4,7 +4,7 @@ - \ No newline at end of file + diff --git a/snippets/csharp/System.Windows.Controls/DataGrid/RowHeaderStyle/properties/settings.designer.cs b/snippets/csharp/System.Windows.Controls/DataGrid/RowHeaderStyle/properties/settings.designer.cs index cba91f5f734..b8e208eb5e2 100644 --- a/snippets/csharp/System.Windows.Controls/DataGrid/RowHeaderStyle/properties/settings.designer.cs +++ b/snippets/csharp/System.Windows.Controls/DataGrid/RowHeaderStyle/properties/settings.designer.cs @@ -8,28 +8,34 @@ // //------------------------------------------------------------------------------ -namespace DataGrid_RowHeader.Properties { - - +namespace DataGrid_RowHeader.Properties +{ + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { + + public static Settings Default + { + get + { return defaultInstance; } } - + [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)] - [global::System.Configuration.DefaultSettingValueAttribute("Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=Tr" + + [global::System.Configuration.DefaultSettingValueAttribute("Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=Tr" + "ue")] - public string AdventureWorksLT2008ConnectionString { - get { + public string AdventureWorksLT2008ConnectionString + { + get + { return ((string)(this["AdventureWorksLT2008ConnectionString"])); } } diff --git a/snippets/csharp/System.Windows.Controls/DataGrid/RowHeaderStyle/properties/settings.settings b/snippets/csharp/System.Windows.Controls/DataGrid/RowHeaderStyle/properties/settings.settings index bed7b52f537..1a1072a5a86 100644 --- a/snippets/csharp/System.Windows.Controls/DataGrid/RowHeaderStyle/properties/settings.settings +++ b/snippets/csharp/System.Windows.Controls/DataGrid/RowHeaderStyle/properties/settings.settings @@ -5,10 +5,10 @@ <?xml version="1.0" encoding="utf-16"?> <SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - <ConnectionString>Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=True</ConnectionString> + <ConnectionString>Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=True</ConnectionString> <ProviderName>System.Data.SqlClient</ProviderName> </SerializableConnectionString> - Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=True + Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=True - \ No newline at end of file + diff --git a/snippets/csharp/System.Windows.Controls/DataGrid/SelectedCellsChanged/app.config b/snippets/csharp/System.Windows.Controls/DataGrid/SelectedCellsChanged/app.config index 0b77f8d0c0d..ff1b6b3a5c2 100644 --- a/snippets/csharp/System.Windows.Controls/DataGrid/SelectedCellsChanged/app.config +++ b/snippets/csharp/System.Windows.Controls/DataGrid/SelectedCellsChanged/app.config @@ -4,7 +4,7 @@ - \ No newline at end of file + diff --git a/snippets/csharp/System.Windows.Controls/DataGrid/SelectedCellsChanged/properties/settings.designer.cs b/snippets/csharp/System.Windows.Controls/DataGrid/SelectedCellsChanged/properties/settings.designer.cs index d5c85194778..f3dcb13b9c6 100644 --- a/snippets/csharp/System.Windows.Controls/DataGrid/SelectedCellsChanged/properties/settings.designer.cs +++ b/snippets/csharp/System.Windows.Controls/DataGrid/SelectedCellsChanged/properties/settings.designer.cs @@ -8,28 +8,34 @@ // //------------------------------------------------------------------------------ -namespace DataGrid_CellSelection.Properties { - - +namespace DataGrid_CellSelection.Properties +{ + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { + + public static Settings Default + { + get + { return defaultInstance; } } - + [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)] - [global::System.Configuration.DefaultSettingValueAttribute("Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=Tr" + + [global::System.Configuration.DefaultSettingValueAttribute("Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=Tr" + "ue")] - public string AdventureWorksLT2008ConnectionString { - get { + public string AdventureWorksLT2008ConnectionString + { + get + { return ((string)(this["AdventureWorksLT2008ConnectionString"])); } } diff --git a/snippets/csharp/System.Windows.Controls/DataGrid/SelectedCellsChanged/properties/settings.settings b/snippets/csharp/System.Windows.Controls/DataGrid/SelectedCellsChanged/properties/settings.settings index e2dbc45ac5d..ec7e9653fae 100644 --- a/snippets/csharp/System.Windows.Controls/DataGrid/SelectedCellsChanged/properties/settings.settings +++ b/snippets/csharp/System.Windows.Controls/DataGrid/SelectedCellsChanged/properties/settings.settings @@ -5,10 +5,10 @@ <?xml version="1.0" encoding="utf-16"?> <SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - <ConnectionString>Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=True</ConnectionString> + <ConnectionString>Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=True</ConnectionString> <ProviderName>System.Data.SqlClient</ProviderName> </SerializableConnectionString> - Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=True + Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=True - \ No newline at end of file + diff --git a/snippets/csharp/System.Windows.Controls/DataGridCheckBoxColumn/Overview/app.config b/snippets/csharp/System.Windows.Controls/DataGridCheckBoxColumn/Overview/app.config index 0db4d1c609e..0069bd698a9 100644 --- a/snippets/csharp/System.Windows.Controls/DataGridCheckBoxColumn/Overview/app.config +++ b/snippets/csharp/System.Windows.Controls/DataGridCheckBoxColumn/Overview/app.config @@ -4,7 +4,7 @@ - \ No newline at end of file + diff --git a/snippets/csharp/System.Windows.Controls/DataGridCheckBoxColumn/Overview/properties/settings.designer.cs b/snippets/csharp/System.Windows.Controls/DataGridCheckBoxColumn/Overview/properties/settings.designer.cs index 2df36ffee05..d8e1d84d6dd 100644 --- a/snippets/csharp/System.Windows.Controls/DataGridCheckBoxColumn/Overview/properties/settings.designer.cs +++ b/snippets/csharp/System.Windows.Controls/DataGridCheckBoxColumn/Overview/properties/settings.designer.cs @@ -8,28 +8,34 @@ // //------------------------------------------------------------------------------ -namespace ColumnsArtSample.Properties { - - +namespace ColumnsArtSample.Properties +{ + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { + + public static Settings Default + { + get + { return defaultInstance; } } - + [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)] - [global::System.Configuration.DefaultSettingValueAttribute("Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=Tr" + + [global::System.Configuration.DefaultSettingValueAttribute("Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=Tr" + "ue")] - public string AdventureWorksLT2008ConnectionString { - get { + public string AdventureWorksLT2008ConnectionString + { + get + { return ((string)(this["AdventureWorksLT2008ConnectionString"])); } } diff --git a/snippets/csharp/System.Windows.Controls/DataGridCheckBoxColumn/Overview/properties/settings.settings b/snippets/csharp/System.Windows.Controls/DataGridCheckBoxColumn/Overview/properties/settings.settings index 8385bee257e..55e0cbc59f1 100644 --- a/snippets/csharp/System.Windows.Controls/DataGridCheckBoxColumn/Overview/properties/settings.settings +++ b/snippets/csharp/System.Windows.Controls/DataGridCheckBoxColumn/Overview/properties/settings.settings @@ -5,10 +5,10 @@ <?xml version="1.0" encoding="utf-16"?> <SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - <ConnectionString>Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=True</ConnectionString> + <ConnectionString>Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=True</ConnectionString> <ProviderName>System.Data.SqlClient</ProviderName> </SerializableConnectionString> - Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=True + Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=True - \ No newline at end of file + diff --git a/snippets/visualbasic/VS_Snippets_Wpf/datagrid1/vb/app.config b/snippets/visualbasic/VS_Snippets_Wpf/datagrid1/vb/app.config index a5a4dd50a27..de32bb97049 100644 --- a/snippets/visualbasic/VS_Snippets_Wpf/datagrid1/vb/app.config +++ b/snippets/visualbasic/VS_Snippets_Wpf/datagrid1/vb/app.config @@ -4,7 +4,7 @@ diff --git a/snippets/visualbasic/VS_Snippets_Wpf/datagrid1/vb/my project/settings.settings b/snippets/visualbasic/VS_Snippets_Wpf/datagrid1/vb/my project/settings.settings index 7e9d98e468d..a6462038dc4 100644 --- a/snippets/visualbasic/VS_Snippets_Wpf/datagrid1/vb/my project/settings.settings +++ b/snippets/visualbasic/VS_Snippets_Wpf/datagrid1/vb/my project/settings.settings @@ -5,10 +5,10 @@ <?xml version="1.0" encoding="utf-16"?> <SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - <ConnectionString>Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=True</ConnectionString> + <ConnectionString>Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=True</ConnectionString> <ProviderName>System.Data.SqlClient</ProviderName> </SerializableConnectionString> - Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=True + Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=True - \ No newline at end of file + diff --git a/snippets/visualbasic/VS_Snippets_Wpf/datagrid_autogencolumns/vb/datagrid_autogencolumns_vb/app.config b/snippets/visualbasic/VS_Snippets_Wpf/datagrid_autogencolumns/vb/datagrid_autogencolumns_vb/app.config index b786eeded20..3fb0e67632f 100644 --- a/snippets/visualbasic/VS_Snippets_Wpf/datagrid_autogencolumns/vb/datagrid_autogencolumns_vb/app.config +++ b/snippets/visualbasic/VS_Snippets_Wpf/datagrid_autogencolumns/vb/datagrid_autogencolumns_vb/app.config @@ -4,7 +4,7 @@ diff --git a/snippets/visualbasic/VS_Snippets_Wpf/datagrid_autogencolumns/vb/datagrid_autogencolumns_vb/my project/settings.settings b/snippets/visualbasic/VS_Snippets_Wpf/datagrid_autogencolumns/vb/datagrid_autogencolumns_vb/my project/settings.settings index 7e9d98e468d..a6462038dc4 100644 --- a/snippets/visualbasic/VS_Snippets_Wpf/datagrid_autogencolumns/vb/datagrid_autogencolumns_vb/my project/settings.settings +++ b/snippets/visualbasic/VS_Snippets_Wpf/datagrid_autogencolumns/vb/datagrid_autogencolumns_vb/my project/settings.settings @@ -5,10 +5,10 @@ <?xml version="1.0" encoding="utf-16"?> <SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - <ConnectionString>Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=True</ConnectionString> + <ConnectionString>Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=True</ConnectionString> <ProviderName>System.Data.SqlClient</ProviderName> </SerializableConnectionString> - Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=True + Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=True - \ No newline at end of file + diff --git a/snippets/visualbasic/VS_Snippets_Wpf/datagrid_cellselection/vb/datagrid_cellselection_vb/app.config b/snippets/visualbasic/VS_Snippets_Wpf/datagrid_cellselection/vb/datagrid_cellselection_vb/app.config index cce63a4bb7b..cf812f7188a 100644 --- a/snippets/visualbasic/VS_Snippets_Wpf/datagrid_cellselection/vb/datagrid_cellselection_vb/app.config +++ b/snippets/visualbasic/VS_Snippets_Wpf/datagrid_cellselection/vb/datagrid_cellselection_vb/app.config @@ -4,7 +4,7 @@ diff --git a/snippets/visualbasic/VS_Snippets_Wpf/datagrid_cellselection/vb/datagrid_cellselection_vb/my project/settings.settings b/snippets/visualbasic/VS_Snippets_Wpf/datagrid_cellselection/vb/datagrid_cellselection_vb/my project/settings.settings index 7e9d98e468d..a6462038dc4 100644 --- a/snippets/visualbasic/VS_Snippets_Wpf/datagrid_cellselection/vb/datagrid_cellselection_vb/my project/settings.settings +++ b/snippets/visualbasic/VS_Snippets_Wpf/datagrid_cellselection/vb/datagrid_cellselection_vb/my project/settings.settings @@ -5,10 +5,10 @@ <?xml version="1.0" encoding="utf-16"?> <SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - <ConnectionString>Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=True</ConnectionString> + <ConnectionString>Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=True</ConnectionString> <ProviderName>System.Data.SqlClient</ProviderName> </SerializableConnectionString> - Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=True + Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=True - \ No newline at end of file + diff --git a/snippets/visualbasic/VS_Snippets_Wpf/datagrid_columnsmanipulation/vb/datagrid_columnsmanipulation_vb/app.config b/snippets/visualbasic/VS_Snippets_Wpf/datagrid_columnsmanipulation/vb/datagrid_columnsmanipulation_vb/app.config index f490311b5d4..7fda9a2d1da 100644 --- a/snippets/visualbasic/VS_Snippets_Wpf/datagrid_columnsmanipulation/vb/datagrid_columnsmanipulation_vb/app.config +++ b/snippets/visualbasic/VS_Snippets_Wpf/datagrid_columnsmanipulation/vb/datagrid_columnsmanipulation_vb/app.config @@ -4,7 +4,7 @@ diff --git a/snippets/visualbasic/VS_Snippets_Wpf/datagrid_columnsmanipulation/vb/datagrid_columnsmanipulation_vb/my project/settings.settings b/snippets/visualbasic/VS_Snippets_Wpf/datagrid_columnsmanipulation/vb/datagrid_columnsmanipulation_vb/my project/settings.settings index 7e9d98e468d..a6462038dc4 100644 --- a/snippets/visualbasic/VS_Snippets_Wpf/datagrid_columnsmanipulation/vb/datagrid_columnsmanipulation_vb/my project/settings.settings +++ b/snippets/visualbasic/VS_Snippets_Wpf/datagrid_columnsmanipulation/vb/datagrid_columnsmanipulation_vb/my project/settings.settings @@ -5,10 +5,10 @@ <?xml version="1.0" encoding="utf-16"?> <SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - <ConnectionString>Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=True</ConnectionString> + <ConnectionString>Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=True</ConnectionString> <ProviderName>System.Data.SqlClient</ProviderName> </SerializableConnectionString> - Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=True + Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=True - \ No newline at end of file + diff --git a/snippets/visualbasic/VS_Snippets_Wpf/datagrid_customcolumns/vb/app.config b/snippets/visualbasic/VS_Snippets_Wpf/datagrid_customcolumns/vb/app.config index 2ae3addd6ca..020160d468b 100644 --- a/snippets/visualbasic/VS_Snippets_Wpf/datagrid_customcolumns/vb/app.config +++ b/snippets/visualbasic/VS_Snippets_Wpf/datagrid_customcolumns/vb/app.config @@ -4,7 +4,7 @@ diff --git a/snippets/visualbasic/VS_Snippets_Wpf/datagrid_customcolumns/vb/my project/settings.settings b/snippets/visualbasic/VS_Snippets_Wpf/datagrid_customcolumns/vb/my project/settings.settings index 7e9d98e468d..a6462038dc4 100644 --- a/snippets/visualbasic/VS_Snippets_Wpf/datagrid_customcolumns/vb/my project/settings.settings +++ b/snippets/visualbasic/VS_Snippets_Wpf/datagrid_customcolumns/vb/my project/settings.settings @@ -5,10 +5,10 @@ <?xml version="1.0" encoding="utf-16"?> <SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - <ConnectionString>Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=True</ConnectionString> + <ConnectionString>Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=True</ConnectionString> <ProviderName>System.Data.SqlClient</ProviderName> </SerializableConnectionString> - Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=True + Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=True - \ No newline at end of file + diff --git a/snippets/visualbasic/VS_Snippets_Wpf/datagrid_frozencolumn/vb/app.config b/snippets/visualbasic/VS_Snippets_Wpf/datagrid_frozencolumn/vb/app.config index d0a0428f348..afa7e56ed76 100644 --- a/snippets/visualbasic/VS_Snippets_Wpf/datagrid_frozencolumn/vb/app.config +++ b/snippets/visualbasic/VS_Snippets_Wpf/datagrid_frozencolumn/vb/app.config @@ -4,7 +4,7 @@ diff --git a/snippets/visualbasic/VS_Snippets_Wpf/datagrid_frozencolumn/vb/my project/settings.settings b/snippets/visualbasic/VS_Snippets_Wpf/datagrid_frozencolumn/vb/my project/settings.settings index 7e9d98e468d..a6462038dc4 100644 --- a/snippets/visualbasic/VS_Snippets_Wpf/datagrid_frozencolumn/vb/my project/settings.settings +++ b/snippets/visualbasic/VS_Snippets_Wpf/datagrid_frozencolumn/vb/my project/settings.settings @@ -5,10 +5,10 @@ <?xml version="1.0" encoding="utf-16"?> <SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - <ConnectionString>Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=True</ConnectionString> + <ConnectionString>Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=True</ConnectionString> <ProviderName>System.Data.SqlClient</ProviderName> </SerializableConnectionString> - Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=True + Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=True - \ No newline at end of file + diff --git a/snippets/visualbasic/VS_Snippets_Wpf/datagrid_rowheader/vb/datagrid_rowheader_vb/app.config b/snippets/visualbasic/VS_Snippets_Wpf/datagrid_rowheader/vb/datagrid_rowheader_vb/app.config index 0a44560a9e3..747658988a4 100644 --- a/snippets/visualbasic/VS_Snippets_Wpf/datagrid_rowheader/vb/datagrid_rowheader_vb/app.config +++ b/snippets/visualbasic/VS_Snippets_Wpf/datagrid_rowheader/vb/datagrid_rowheader_vb/app.config @@ -4,7 +4,7 @@ diff --git a/snippets/visualbasic/VS_Snippets_Wpf/datagrid_rowheader/vb/datagrid_rowheader_vb/my project/settings.settings b/snippets/visualbasic/VS_Snippets_Wpf/datagrid_rowheader/vb/datagrid_rowheader_vb/my project/settings.settings index 7e9d98e468d..a6462038dc4 100644 --- a/snippets/visualbasic/VS_Snippets_Wpf/datagrid_rowheader/vb/datagrid_rowheader_vb/my project/settings.settings +++ b/snippets/visualbasic/VS_Snippets_Wpf/datagrid_rowheader/vb/datagrid_rowheader_vb/my project/settings.settings @@ -5,10 +5,10 @@ <?xml version="1.0" encoding="utf-16"?> <SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - <ConnectionString>Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=True</ConnectionString> + <ConnectionString>Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=True</ConnectionString> <ProviderName>System.Data.SqlClient</ProviderName> </SerializableConnectionString> - Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=True + Data Source=localhost;Initial Catalog=AdventureWorksLT2008;Integrated Security=True - \ No newline at end of file + From 912ede2f9f5c5eaba42c13d37172f5381b69bf28 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Tue, 1 Oct 2024 12:35:19 -0700 Subject: [PATCH 2/7] ROPC fixes in C# files (#10479) --- .../System.Data/EntityKey/Overview/app.config | 6 +- .../Overview/web.config.backup.1 | 46 -- .../Overview/web.config.backup.1 | 46 -- .../Overview/web.config.backup.1 | 46 -- .../CS/Project.csproj | 12 + .../Classic WebData OdbcCommand/CS/source.cs | 6 +- .../CS/Project.csproj | 12 + .../CS/source.cs | 7 +- .../CS/Project.csproj | 12 + .../CS/source.cs | 7 +- .../CS/Project.csproj | 12 + .../CS/source.cs | 8 - .../CS/Project.csproj | 12 + .../CS/source.cs | 8 - .../CS/Project.csproj | 12 + .../CS/source.cs | 6 - .../CS/Project.csproj | 12 + .../CS/source.cs | 6 - .../CS/Project.csproj | 12 + .../CS/source.cs | 6 - .../CS/Project.csproj | 12 + .../CS/source.cs | 6 - .../CS/Project.csproj | 12 + .../CS/source.cs | 6 - .../CS/Project.csproj | 12 + .../CS/source.cs | 6 - .../CS/Project.csproj | 12 + .../CS/source.cs | 6 - .../CS/Project.csproj | 12 + .../CS/source.cs | 6 - .../CS/Project.csproj | 12 + .../CS/source.cs | 5 - .../CS/Project.csproj | 12 + .../CS/source.cs | 6 - .../CS/Project.csproj | 12 + .../CS/source.cs | 3 +- .../CS/Project.csproj | 12 + .../CS/source.cs | 8 - .../CS/Project.csproj | 12 + .../CS/source.cs | 6 - .../CS/Project.csproj | 12 + .../CS/source.cs | 5 - .../CS/Project.csproj | 12 + .../CS/source.cs | 6 - .../CS/Project.csproj | 12 + .../CS/Project.csproj | 12 + .../CS/Project.csproj | 12 + .../CS/Project.csproj | 12 + .../CS/Source.cs | 6 - .../CS/Project.csproj | 12 + .../CS/Project.csproj | 2 +- .../CS/source.cs | 7 - .../CS/Project.csproj | 12 + .../CS/source.cs | 7 - .../CS/Project.csproj | 2 +- .../CS/source.cs | 7 - .../CS/Project.csproj | 2 +- .../CS/source.cs | 7 - .../CS/Project.csproj | 12 + .../CS/source.cs | 6 - .../CS/Project.csproj | 12 + .../CS/source.cs | 7 - .../CS/SqlDataReader.Read.csproj | 2 +- .../CS/source.cs | 13 +- .../CS/LINQtoDataSetExamplesCS.csproj | 64 +- .../DP LINQ to DataSet Examples/CS/Program.cs | 9 +- .../CS/Properties/AssemblyInfo.cs | 36 - .../CS/source.cs | 41 -- .../CS/source.cs | 5 - .../Project.csproj | 12 + .../CS/Project.csproj | 12 + .../CS/source.cs | 25 +- .../CS/source.cs | 51 -- .../CS/Project.csproj | 12 + .../CS/source.cs | 1 - .../CS/Project.csproj | 13 + .../CS/source.cs | 24 +- .../idatareader_nextresult/cs/Project.csproj | 14 + .../idatareader_nextresult/cs/source.cs | 189 +++--- .../CS/ConfigurationStringSettings.cs | 7 +- .../CS/ConnectionStrings.cs | 66 +- .../CS/Project.csproj | 16 + .../CS/Project.csproj | 13 + .../CS/WebConfigurationManager.cs | 190 +++--- .../CS/sql22cs.aspx | 88 --- .../ConfigurationManager.xml | 58 -- .../ConnectionStringSettingsCollection.xml | 176 +++-- .../ConnectionStringsSection.xml | 50 +- .../ProtectedConfigurationProvider.xml | 27 - .../DbConnectionStringBuilder.xml | 23 +- .../EntityConnectionStringBuilder.xml | 6 - .../OdbcConnectionStringBuilder.xml | 2 - .../OleDbConnectionStringBuilder.xml | 11 - .../OracleConnectionStringBuilder.xml | 527 ++++++++------- xml/System.Data.SqlClient/SqlCredential.xml | 69 +- xml/System.Web.Caching/SqlCacheDependency.xml | 4 +- xml/System.Web.UI.WebControls/Parameter.xml | 628 +++++++++--------- .../QueryStringParameter.xml | 219 +++--- .../SqlDataSource.xml | 19 +- 99 files changed, 1490 insertions(+), 1888 deletions(-) delete mode 100644 snippets/csharp/System.IdentityModel.Services/SessionAuthenticationModule/Overview/web.config.backup.1 delete mode 100644 snippets/csharp/System.IdentityModel.Services/SignInRequestMessage/Overview/web.config.backup.1 delete mode 100644 snippets/csharp/System.IdentityModel.Services/WSFederationAuthenticationModule/Overview/web.config.backup.1 create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcCommand/CS/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction/CS/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction1/CS/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.Close/CS/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection/CS/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.DeleteCommand/CS/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.InsertCommand/CS/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter/CS/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter1/CS/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter2/CS/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter3/CS/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.SelectCommand/CS/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.UpdateCommand/CS/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter/CS/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcParameter/CS/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbCommand.ExecuteNonQuery Example/CS/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbCommand.Prepare Example/CS/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbDataReader.GetOrdinal/CS/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbParameter Example/CS/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand Example/CS/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand.Connection Example/CS/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand.ExecuteNonQuery Example/CS/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand.ExecuteXmlReader/CS/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand.Prepare/CS/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand.SqlCommand2 Example/CS/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction1 Example/CS/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Close Example/CS/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.GetOrdinal/CS/Project.csproj delete mode 100644 snippets/csharp/VS_Snippets_ADO.NET/DP LINQ to DataSet Examples/CS/Properties/AssemblyInfo.cs delete mode 100644 snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.Add/CS/source.cs create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.ConnectionString/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder/CS/Project.csproj delete mode 100644 snippets/csharp/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder.Clear/CS/source.cs create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder.Item/CS/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.ContainsKey/CS/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_ADO.NET/idatareader_nextresult/cs/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/CS/Project.csproj create mode 100644 snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.WebConfigurationManager/CS/Project.csproj delete mode 100644 snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSource_22sql/CS/sql22cs.aspx diff --git a/snippets/csharp/System.Data/EntityKey/Overview/app.config b/snippets/csharp/System.Data/EntityKey/Overview/app.config index bc5cd770d42..936b73f4837 100644 --- a/snippets/csharp/System.Data/EntityKey/Overview/app.config +++ b/snippets/csharp/System.Data/EntityKey/Overview/app.config @@ -1,7 +1,7 @@  - - + + - \ No newline at end of file + diff --git a/snippets/csharp/System.IdentityModel.Services/SessionAuthenticationModule/Overview/web.config.backup.1 b/snippets/csharp/System.IdentityModel.Services/SessionAuthenticationModule/Overview/web.config.backup.1 deleted file mode 100644 index 4e807904ac4..00000000000 --- a/snippets/csharp/System.IdentityModel.Services/SessionAuthenticationModule/Overview/web.config.backup.1 +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/snippets/csharp/System.IdentityModel.Services/SignInRequestMessage/Overview/web.config.backup.1 b/snippets/csharp/System.IdentityModel.Services/SignInRequestMessage/Overview/web.config.backup.1 deleted file mode 100644 index 4e807904ac4..00000000000 --- a/snippets/csharp/System.IdentityModel.Services/SignInRequestMessage/Overview/web.config.backup.1 +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/snippets/csharp/System.IdentityModel.Services/WSFederationAuthenticationModule/Overview/web.config.backup.1 b/snippets/csharp/System.IdentityModel.Services/WSFederationAuthenticationModule/Overview/web.config.backup.1 deleted file mode 100644 index 4e807904ac4..00000000000 --- a/snippets/csharp/System.IdentityModel.Services/WSFederationAuthenticationModule/Overview/web.config.backup.1 +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcCommand/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcCommand/CS/Project.csproj new file mode 100644 index 00000000000..283a2efeb88 --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcCommand/CS/Project.csproj @@ -0,0 +1,12 @@ + + + + Library + net8 + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcCommand/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcCommand/CS/source.cs index 3fee1b2cb1c..d533e0a3ff5 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcCommand/CS/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcCommand/CS/source.cs @@ -4,10 +4,6 @@ class Program { - static void Main() - { - //string connectionString = "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\\Samples\\Northwind.mdb"; - } // public void InsertRow(string connectionString, string insertSQL) { @@ -31,6 +27,6 @@ public void InsertRow(string connectionString, string insertSQL) // The connection is automatically closed when the // code exits the using block. } - // } + // } diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction/CS/Project.csproj new file mode 100644 index 00000000000..283a2efeb88 --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction/CS/Project.csproj @@ -0,0 +1,12 @@ + + + + Library + net8 + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction/CS/source.cs index 3c0ac36c465..432ea039af5 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction/CS/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction/CS/source.cs @@ -4,11 +4,6 @@ class Program { - static void Main() - { - string connectionString = "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\\Samples\\Northwind.mdb"; - ExecuteTransaction(connectionString); - } // public static void ExecuteTransaction(string connectionString) { @@ -61,6 +56,6 @@ public static void ExecuteTransaction(string connectionString) // The connection is automatically closed when the // code exits the using block. } - // } + // } diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction1/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction1/CS/Project.csproj new file mode 100644 index 00000000000..283a2efeb88 --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction1/CS/Project.csproj @@ -0,0 +1,12 @@ + + + + Library + net8 + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction1/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction1/CS/source.cs index 3c0ac36c465..432ea039af5 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction1/CS/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction1/CS/source.cs @@ -4,11 +4,6 @@ class Program { - static void Main() - { - string connectionString = "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\\Samples\\Northwind.mdb"; - ExecuteTransaction(connectionString); - } // public static void ExecuteTransaction(string connectionString) { @@ -61,6 +56,6 @@ public static void ExecuteTransaction(string connectionString) // The connection is automatically closed when the // code exits the using block. } - // } + // } diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.Close/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.Close/CS/Project.csproj new file mode 100644 index 00000000000..283a2efeb88 --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.Close/CS/Project.csproj @@ -0,0 +1,12 @@ + + + + Library + net8 + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.Close/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.Close/CS/source.cs index e5d7180cabd..53ec3b2ac53 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.Close/CS/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.Close/CS/source.cs @@ -7,14 +7,6 @@ namespace Classic_WebData_OdbcConnection.CloseCS { class Program { - static void Main(string[] args) - { - string connectionString; - connectionString = "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\\Samples\\Northwind.mdb"; - - CreateOdbcConnection(connectionString); - } - // private static void CreateOdbcConnection(string connectionString) { diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection/CS/Project.csproj new file mode 100644 index 00000000000..283a2efeb88 --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection/CS/Project.csproj @@ -0,0 +1,12 @@ + + + + Library + net8 + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection/CS/source.cs index 7f7abb85a06..5767b6b5c32 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection/CS/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcConnection/CS/source.cs @@ -7,14 +7,6 @@ namespace Classic_WebData_OdbcConnectionCS { class Program { - static void Main() - { - string connectionString; - connectionString = "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\\Samples\\Northwind.mdb"; - - InsertRow(connectionString); - } - // static private void InsertRow(string connectionString) { diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.DeleteCommand/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.DeleteCommand/CS/Project.csproj new file mode 100644 index 00000000000..283a2efeb88 --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.DeleteCommand/CS/Project.csproj @@ -0,0 +1,12 @@ + + + + Library + net8 + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.DeleteCommand/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.DeleteCommand/CS/source.cs index 773df29712d..d0501376f81 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.DeleteCommand/CS/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.DeleteCommand/CS/source.cs @@ -4,12 +4,6 @@ class Program { - static void Main() - { - //string connectionString = "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\\Samples\\Northwind.mdb"; - //string x = "DRIVER={SQL Server};SERVER=MyServer;Trusted_connection=yes;DATABASE=Northwind;" - } - // public static OdbcDataAdapter CreateDataAdapter( OdbcConnection connection) diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.InsertCommand/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.InsertCommand/CS/Project.csproj new file mode 100644 index 00000000000..283a2efeb88 --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.InsertCommand/CS/Project.csproj @@ -0,0 +1,12 @@ + + + + Library + net8 + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.InsertCommand/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.InsertCommand/CS/source.cs index 773df29712d..d0501376f81 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.InsertCommand/CS/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.InsertCommand/CS/source.cs @@ -4,12 +4,6 @@ class Program { - static void Main() - { - //string connectionString = "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\\Samples\\Northwind.mdb"; - //string x = "DRIVER={SQL Server};SERVER=MyServer;Trusted_connection=yes;DATABASE=Northwind;" - } - // public static OdbcDataAdapter CreateDataAdapter( OdbcConnection connection) diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter/CS/Project.csproj new file mode 100644 index 00000000000..283a2efeb88 --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter/CS/Project.csproj @@ -0,0 +1,12 @@ + + + + Library + net8 + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter/CS/source.cs index 773df29712d..d0501376f81 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter/CS/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter/CS/source.cs @@ -4,12 +4,6 @@ class Program { - static void Main() - { - //string connectionString = "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\\Samples\\Northwind.mdb"; - //string x = "DRIVER={SQL Server};SERVER=MyServer;Trusted_connection=yes;DATABASE=Northwind;" - } - // public static OdbcDataAdapter CreateDataAdapter( OdbcConnection connection) diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter1/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter1/CS/Project.csproj new file mode 100644 index 00000000000..283a2efeb88 --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter1/CS/Project.csproj @@ -0,0 +1,12 @@ + + + + Library + net8 + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter1/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter1/CS/source.cs index 773df29712d..d0501376f81 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter1/CS/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter1/CS/source.cs @@ -4,12 +4,6 @@ class Program { - static void Main() - { - //string connectionString = "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\\Samples\\Northwind.mdb"; - //string x = "DRIVER={SQL Server};SERVER=MyServer;Trusted_connection=yes;DATABASE=Northwind;" - } - // public static OdbcDataAdapter CreateDataAdapter( OdbcConnection connection) diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter2/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter2/CS/Project.csproj new file mode 100644 index 00000000000..283a2efeb88 --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter2/CS/Project.csproj @@ -0,0 +1,12 @@ + + + + Library + net8 + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter2/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter2/CS/source.cs index 773df29712d..d0501376f81 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter2/CS/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter2/CS/source.cs @@ -4,12 +4,6 @@ class Program { - static void Main() - { - //string connectionString = "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\\Samples\\Northwind.mdb"; - //string x = "DRIVER={SQL Server};SERVER=MyServer;Trusted_connection=yes;DATABASE=Northwind;" - } - // public static OdbcDataAdapter CreateDataAdapter( OdbcConnection connection) diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter3/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter3/CS/Project.csproj new file mode 100644 index 00000000000..283a2efeb88 --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter3/CS/Project.csproj @@ -0,0 +1,12 @@ + + + + Library + net8 + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter3/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter3/CS/source.cs index 773df29712d..d0501376f81 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter3/CS/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter3/CS/source.cs @@ -4,12 +4,6 @@ class Program { - static void Main() - { - //string connectionString = "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\\Samples\\Northwind.mdb"; - //string x = "DRIVER={SQL Server};SERVER=MyServer;Trusted_connection=yes;DATABASE=Northwind;" - } - // public static OdbcDataAdapter CreateDataAdapter( OdbcConnection connection) diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.SelectCommand/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.SelectCommand/CS/Project.csproj new file mode 100644 index 00000000000..283a2efeb88 --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.SelectCommand/CS/Project.csproj @@ -0,0 +1,12 @@ + + + + Library + net8 + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.SelectCommand/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.SelectCommand/CS/source.cs index 773df29712d..d0501376f81 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.SelectCommand/CS/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.SelectCommand/CS/source.cs @@ -4,12 +4,6 @@ class Program { - static void Main() - { - //string connectionString = "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\\Samples\\Northwind.mdb"; - //string x = "DRIVER={SQL Server};SERVER=MyServer;Trusted_connection=yes;DATABASE=Northwind;" - } - // public static OdbcDataAdapter CreateDataAdapter( OdbcConnection connection) diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.UpdateCommand/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.UpdateCommand/CS/Project.csproj new file mode 100644 index 00000000000..283a2efeb88 --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.UpdateCommand/CS/Project.csproj @@ -0,0 +1,12 @@ + + + + Library + net8 + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.UpdateCommand/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.UpdateCommand/CS/source.cs index 773df29712d..d0501376f81 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.UpdateCommand/CS/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.UpdateCommand/CS/source.cs @@ -4,12 +4,6 @@ class Program { - static void Main() - { - //string connectionString = "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\\Samples\\Northwind.mdb"; - //string x = "DRIVER={SQL Server};SERVER=MyServer;Trusted_connection=yes;DATABASE=Northwind;" - } - // public static OdbcDataAdapter CreateDataAdapter( OdbcConnection connection) diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter/CS/Project.csproj new file mode 100644 index 00000000000..283a2efeb88 --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter/CS/Project.csproj @@ -0,0 +1,12 @@ + + + + Library + net8 + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter/CS/source.cs index 21004c745d1..924e2ee4879 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter/CS/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter/CS/source.cs @@ -4,11 +4,6 @@ class Program { - static void Main() - { - //string connectionString = "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\\Samples\\Northwind.mdb"; - } - // public DataSet GetDataSetFromAdapter( DataSet dataSet, string connectionString, string queryString) diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcParameter/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcParameter/CS/Project.csproj new file mode 100644 index 00000000000..283a2efeb88 --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcParameter/CS/Project.csproj @@ -0,0 +1,12 @@ + + + + Library + net8 + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcParameter/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcParameter/CS/source.cs index b557a3aa06f..976d0d76abb 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcParameter/CS/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OdbcParameter/CS/source.cs @@ -4,12 +4,6 @@ class Program { - static void Main() - { - //string connectionString = "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\\Samples\\Northwind.mdb"; - //string x = "DRIVER={SQL Server};SERVER=MyServer;Trusted_connection=yes;DATABASE=Northwind;" - } - // public DataSet GetDataSetFromAdapter( DataSet dataSet, string connectionString, string queryString) diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbCommand.ExecuteNonQuery Example/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbCommand.ExecuteNonQuery Example/CS/Project.csproj new file mode 100644 index 00000000000..97983414e1e --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbCommand.ExecuteNonQuery Example/CS/Project.csproj @@ -0,0 +1,12 @@ + + + + Exe + net8 + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbCommand.ExecuteNonQuery Example/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbCommand.ExecuteNonQuery Example/CS/source.cs index 4d87fc4a868..846bfa072a3 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbCommand.ExecuteNonQuery Example/CS/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbCommand.ExecuteNonQuery Example/CS/source.cs @@ -8,8 +8,7 @@ class Program { static void Main() { - string connectionString = "Provider=sqloledb;Data Source=(local);Initial Catalog=Northwind;" - + "Integrated Security=SSPI"; + string connectionString = "Provider=sqloledb;Data Source=(local);Initial Catalog=Northwind;Integrated Security=SSPI"; string queryString = "UPDATE Shippers SET CompanyName = 'Speedy Expresss' WHERE ShipperID = 1"; CreateOleDbCommand(queryString, connectionString); Console.ReadLine(); diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbCommand.Prepare Example/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbCommand.Prepare Example/CS/Project.csproj new file mode 100644 index 00000000000..ed52be723a6 --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbCommand.Prepare Example/CS/Project.csproj @@ -0,0 +1,12 @@ + + + + Library + net8 + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbCommand.Prepare Example/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbCommand.Prepare Example/CS/source.cs index dbe5c864f62..4fffeecc2a8 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbCommand.Prepare Example/CS/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbCommand.Prepare Example/CS/source.cs @@ -6,14 +6,6 @@ namespace OleDbCommandPrepareCS { class Program { - static void Main() - { - string connectionString = "Provider=sqloledb;Data Source=(local);Initial Catalog=Northwind;" - + "Integrated Security=SSPI"; - OleDbCommandPrepare(connectionString); - Console.ReadLine(); - } - // private static void OleDbCommandPrepare(string connectionString) { diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbDataReader.GetOrdinal/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbDataReader.GetOrdinal/CS/Project.csproj new file mode 100644 index 00000000000..ed52be723a6 --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbDataReader.GetOrdinal/CS/Project.csproj @@ -0,0 +1,12 @@ + + + + Library + net8 + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbDataReader.GetOrdinal/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbDataReader.GetOrdinal/CS/source.cs index 85ae4b28733..d5fe617a207 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbDataReader.GetOrdinal/CS/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbDataReader.GetOrdinal/CS/source.cs @@ -4,12 +4,6 @@ class Class1 { - static void Main() - { - string x = "Provider=SQLOLEDB;Data Source=(local);Integrated Security=SSPI;Initial Catalog=Northwind"; - ReadData(x); - } - // public static void ReadData(string connectionString) { diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbParameter Example/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbParameter Example/CS/Project.csproj new file mode 100644 index 00000000000..ed52be723a6 --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbParameter Example/CS/Project.csproj @@ -0,0 +1,12 @@ + + + + Library + net8 + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbParameter Example/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbParameter Example/CS/source.cs index 22c5a754ba9..ebedc213c33 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbParameter Example/CS/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData OleDbParameter Example/CS/source.cs @@ -4,11 +4,6 @@ class Class1 { - static void Main() - { - // string x = "Provider=SQLOLEDB;Data Source=(local);Integrated Security=SSPI;Initial Catalog=Northwind"; - } - // public DataSet GetDataSetFromAdapter( DataSet dataSet, string connectionString, string queryString) diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand Example/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand Example/CS/Project.csproj new file mode 100644 index 00000000000..1c164d356f7 --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand Example/CS/Project.csproj @@ -0,0 +1,12 @@ + + + + Library + net8 + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand Example/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand Example/CS/source.cs index 38156804352..d259578fe2c 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand Example/CS/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand Example/CS/source.cs @@ -8,12 +8,6 @@ namespace SqlCommandCS { class Program { - static void Main() - { - string str = "Data Source=(local);Initial Catalog=Northwind;" - + "Integrated Security=SSPI"; - ReadOrderData(str); - } // private static void ReadOrderData(string connectionString) { diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand.Connection Example/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand.Connection Example/CS/Project.csproj new file mode 100644 index 00000000000..40f16ef424e --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand.Connection Example/CS/Project.csproj @@ -0,0 +1,12 @@ + + + + Exe + net8 + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand.ExecuteNonQuery Example/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand.ExecuteNonQuery Example/CS/Project.csproj new file mode 100644 index 00000000000..40f16ef424e --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand.ExecuteNonQuery Example/CS/Project.csproj @@ -0,0 +1,12 @@ + + + + Exe + net8 + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand.ExecuteXmlReader/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand.ExecuteXmlReader/CS/Project.csproj new file mode 100644 index 00000000000..40f16ef424e --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand.ExecuteXmlReader/CS/Project.csproj @@ -0,0 +1,12 @@ + + + + Exe + net8 + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand.Prepare/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand.Prepare/CS/Project.csproj new file mode 100644 index 00000000000..0ff7e2c779d --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand.Prepare/CS/Project.csproj @@ -0,0 +1,12 @@ + + + + Library + net4.8 + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand.Prepare/CS/Source.cs b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand.Prepare/CS/Source.cs index f2755c1a916..24de3ae7c0f 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand.Prepare/CS/Source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand.Prepare/CS/Source.cs @@ -6,12 +6,6 @@ namespace SqlPrepareCS { class Program { - static void Main() - { - string connectionString = "Persist Security Info=False;Integrated Security=SSPI;database=Northwind;server=(local)"; - SqlCommandPrepareEx(connectionString); - Console.ReadLine(); - } // private static void SqlCommandPrepareEx(string connectionString) { diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand.SqlCommand2 Example/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand.SqlCommand2 Example/CS/Project.csproj new file mode 100644 index 00000000000..40f16ef424e --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlCommand.SqlCommand2 Example/CS/Project.csproj @@ -0,0 +1,12 @@ + + + + Exe + net8 + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction Example/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction Example/CS/Project.csproj index 9de5f49321c..b8fcb56ef9d 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction Example/CS/Project.csproj +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction Example/CS/Project.csproj @@ -1,7 +1,7 @@ - Exe + Library net8.0 diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction Example/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction Example/CS/source.cs index 7c1bf2110a6..8f520e65ab9 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction Example/CS/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction Example/CS/source.cs @@ -6,13 +6,6 @@ namespace Transaction1CS { class Program { - static void Main() - { - string connectionString = - "Persist Security Info=False;Integrated Security=SSPI;database=Northwind;server=(local)"; - ExecuteSqlTransaction(connectionString); - Console.ReadLine(); - } // private static void ExecuteSqlTransaction(string connectionString) { diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction1 Example/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction1 Example/CS/Project.csproj new file mode 100644 index 00000000000..1c164d356f7 --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction1 Example/CS/Project.csproj @@ -0,0 +1,12 @@ + + + + Library + net8 + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction1 Example/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction1 Example/CS/source.cs index ba2fc1da85a..6fc3c7ee3ce 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction1 Example/CS/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction1 Example/CS/source.cs @@ -4,13 +4,6 @@ class Program { - static void Main() - { - string connectionString = - "Persist Security Info=False;Integrated Security=SSPI;database=Northwind;server=(local)"; - ExecuteSqlTransaction(connectionString); - Console.ReadLine(); - } // private static void ExecuteSqlTransaction(string connectionString) { diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction2 Example/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction2 Example/CS/Project.csproj index 9de5f49321c..b8fcb56ef9d 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction2 Example/CS/Project.csproj +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction2 Example/CS/Project.csproj @@ -1,7 +1,7 @@ - Exe + Library net8.0 diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction2 Example/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction2 Example/CS/source.cs index 5d9481de004..a5d8137f8ac 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction2 Example/CS/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction2 Example/CS/source.cs @@ -6,13 +6,6 @@ namespace Transaction1CS { class Program { - static void Main() - { - string connectionString = - "Persist Security Info=False;Integrated Security=SSPI;database=Northwind;server=(local)"; - ExecuteSqlTransaction(connectionString); - Console.ReadLine(); - } // private static void ExecuteSqlTransaction(string connectionString) { diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction3 Example/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction3 Example/CS/Project.csproj index 9de5f49321c..b8fcb56ef9d 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction3 Example/CS/Project.csproj +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction3 Example/CS/Project.csproj @@ -1,7 +1,7 @@ - Exe + Library net8.0 diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction3 Example/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction3 Example/CS/source.cs index 526a9b14528..af32b2bbdb2 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction3 Example/CS/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction3 Example/CS/source.cs @@ -6,13 +6,6 @@ namespace Transaction1CS { class Program { - static void Main() - { - string connectionString = - "Persist Security Info=False;Integrated Security=SSPI;database=Northwind;server=(local)"; - ExecuteSqlTransaction(connectionString); - Console.ReadLine(); - } // private static void ExecuteSqlTransaction(string connectionString) { diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Close Example/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Close Example/CS/Project.csproj new file mode 100644 index 00000000000..1c164d356f7 --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Close Example/CS/Project.csproj @@ -0,0 +1,12 @@ + + + + Library + net8 + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Close Example/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Close Example/CS/source.cs index 5df069e85c2..39227080837 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Close Example/CS/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Close Example/CS/source.cs @@ -5,12 +5,6 @@ class Program { - static void Main() - { - string str = "Data Source=(local);Initial Catalog=Northwind;" - + "Integrated Security=SSPI"; - ReadOrderData(str); - } // private static void ReadOrderData(string connectionString) { diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.GetOrdinal/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.GetOrdinal/CS/Project.csproj new file mode 100644 index 00000000000..1c164d356f7 --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.GetOrdinal/CS/Project.csproj @@ -0,0 +1,12 @@ + + + + Library + net8 + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.GetOrdinal/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.GetOrdinal/CS/source.cs index b8cac5fefd1..26e9b09fb95 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.GetOrdinal/CS/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.GetOrdinal/CS/source.cs @@ -5,13 +5,6 @@ class Program { - static void Main() - { - string str = "Data Source=(local);Initial Catalog=Northwind;" - + "Integrated Security=SSPI"; - ReadGetOrdinal(str); - } - // private static void ReadGetOrdinal(string connectionString) { diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Read Example/CS/SqlDataReader.Read.csproj b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Read Example/CS/SqlDataReader.Read.csproj index 9de5f49321c..b8fcb56ef9d 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Read Example/CS/SqlDataReader.Read.csproj +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Read Example/CS/SqlDataReader.Read.csproj @@ -1,7 +1,7 @@ - Exe + Library net8.0 diff --git a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Read Example/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Read Example/CS/source.cs index d124ecf4cf6..576c7339184 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Read Example/CS/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Read Example/CS/source.cs @@ -1,17 +1,10 @@ -// -using System; +using System; using System.Data; using System.Data.SqlClient; class Program { - static void Main() - { - string str = "Data Source=(local);Initial Catalog=Northwind;" - + "Integrated Security=SSPI"; - ReadOrderData(str); - } - + // private static void ReadOrderData(string connectionString) { string queryString = @@ -41,5 +34,5 @@ private static void ReadSingleRow(IDataRecord dataRecord) { Console.WriteLine(String.Format("{0}, {1}", dataRecord[0], dataRecord[1])); } + // } -// \ No newline at end of file diff --git a/snippets/csharp/VS_Snippets_ADO.NET/DP LINQ to DataSet Examples/CS/LINQtoDataSetExamplesCS.csproj b/snippets/csharp/VS_Snippets_ADO.NET/DP LINQ to DataSet Examples/CS/LINQtoDataSetExamplesCS.csproj index 160408c37bf..f424ed69192 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/DP LINQ to DataSet Examples/CS/LINQtoDataSetExamplesCS.csproj +++ b/snippets/csharp/VS_Snippets_ADO.NET/DP LINQ to DataSet Examples/CS/LINQtoDataSetExamplesCS.csproj @@ -1,60 +1,18 @@ - - + + - Debug - AnyCPU - 9.0.20829 - 2.0 - {404E1785-83BF-4026-B6D7-DC2AA2228D3F} Exe - Properties - DP_LINQ_to_DataSet_Examples - DP LINQ to DataSet Examples - v3.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 + net4.8 + 11 + - - - 3.5 - - - - 3.5 - - - 3.5 - - - + + - - + + - - - \ No newline at end of file + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/DP LINQ to DataSet Examples/CS/Program.cs b/snippets/csharp/VS_Snippets_ADO.NET/DP LINQ to DataSet Examples/CS/Program.cs index f5919ba1d81..b8eedad6b24 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/DP LINQ to DataSet Examples/CS/Program.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/DP LINQ to DataSet Examples/CS/Program.cs @@ -1,14 +1,12 @@ // using System; -using System.Linq; -using System.Linq.Expressions; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; -using System.Data.Common; using System.Globalization; -// +using System.Linq; using System.Windows.Forms; +// namespace LINQtoDataSetSamples { @@ -2624,8 +2622,7 @@ static 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, " + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/DP LINQ to DataSet Examples/CS/Properties/AssemblyInfo.cs b/snippets/csharp/VS_Snippets_ADO.NET/DP LINQ to DataSet Examples/CS/Properties/AssemblyInfo.cs deleted file mode 100644 index cd871ea62ac..00000000000 --- a/snippets/csharp/VS_Snippets_ADO.NET/DP LINQ to DataSet Examples/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("DP LINQ to DataSet Examples")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("msft")] -[assembly: AssemblyProduct("DP LINQ to DataSet Examples")] -[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("98861c2d-73b2-44ca-9382-3ae1e7839cd4")] - -// 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/csharp/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.Add/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.Add/CS/source.cs deleted file mode 100644 index e899747029f..00000000000 --- a/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.Add/CS/source.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Data; -using System.Data.Common; - -namespace ConBuilderAddCS -{ - class Program - { - // - static void Main() - { - try - { - DbConnectionStringBuilder builder = - new DbConnectionStringBuilder(); - builder.Add("Data Source", "ServerName"); - builder.Add("Initial Catalog", "TheDatabase"); - builder.Add("User ID", "UserName"); - builder.Add("Password", "*******"); - builder.Add("Command Logging", false); - - // Overwrite the existing "User ID" value. - builder.Add("User ID", "NewUserName"); - - // The following code would trigger - // an ArgumentNullException: - // builder.Add(null, "Some Value"); - - Console.WriteLine(builder.ConnectionString); - } - catch (ArgumentNullException) - { - Console.WriteLine("Null key values are not allowed."); - } - - Console.WriteLine("Press Enter to continue."); - Console.ReadLine(); - } - // - } -} diff --git a/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.ConnectionString/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.ConnectionString/CS/source.cs index 45e4307be0b..a90c8768e63 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.ConnectionString/CS/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.ConnectionString/CS/source.cs @@ -15,7 +15,6 @@ static void Main() DbConnectionStringBuilder(); builder.Add("Data Source", @"c:\MyData\MyDb.mdb"); builder.Add("Provider", "Microsoft.Jet.Oledb.4.0"); - builder.Add("Jet OLEDB:Database Password", "********"); builder.Add("Jet OLEDB:System Database", @"c:\MyData\Workgroup.mdb"); @@ -62,10 +61,6 @@ static void Main() { Console.WriteLine("Invalid connection string."); } - - Console.WriteLine(); - Console.WriteLine("Press Enter to finish."); - Console.ReadLine(); } // } diff --git a/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.ConnectionString/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.ConnectionString/Project.csproj new file mode 100644 index 00000000000..84455e1397c --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.ConnectionString/Project.csproj @@ -0,0 +1,12 @@ + + + + Exe + net4.8 + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder/CS/Project.csproj new file mode 100644 index 00000000000..09e9769f543 --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder/CS/Project.csproj @@ -0,0 +1,12 @@ + + + + Exe + net4.8 + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder/CS/source.cs index 7d4c4e7aa1d..ceb9945ffec 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder/CS/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder/CS/source.cs @@ -8,16 +8,13 @@ namespace ConBuilderCS { class Program { - // static void Main() { + // DbConnectionStringBuilder builder = new DbConnectionStringBuilder(); builder.ConnectionString = @"Data Source=c:\MyData\MyDb.mdb"; builder.Add("Provider", "Microsoft.Jet.Oledb.4.0"); - builder.Add("Jet OLEDB:Database Password", "*******"); - builder.Add("Jet OLEDB:System Database", - @"c:\MyData\Workgroup.mdb"); // Set up row-level locking. builder.Add("Jet OLEDB:Database Locking Mode", 1); @@ -26,7 +23,7 @@ static void Main() // build any type of connection string using // this class. - // The ConnectionString property may have been + // The ConnectionString property might have been // formatted by the DbConnectionStringBuilder class. OleDbConnection oledbConnect = new OleDbConnection(builder.ConnectionString); @@ -46,25 +43,13 @@ static void Main() // Pass the DbConnectionStringBuilder an existing // connection string, and you can retrieve and // modify any of the elements. - builder.ConnectionString = "server=(local);user id=*******;" + - "password=*******;initial catalog=AdventureWorks"; + builder.ConnectionString = "server=(local);initial catalog=AdventureWorks"; builder["Server"] = "."; - builder.Remove("User ID"); - // Note that calling Remove on a nonexistent item doesn't - // throw an exception. - builder.Remove("BadItem"); - - // Setting the indexer adds the value if - // necessary. + // Setting the indexer adds the value, if necessary. builder["Integrated Security"] = true; - builder.Remove("password"); - builder["User ID"] = "Hello"; Console.WriteLine(builder.ConnectionString); - - Console.WriteLine("Press Enter to finish."); - Console.ReadLine(); + // } - // } } diff --git a/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder.Clear/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder.Clear/CS/source.cs deleted file mode 100644 index 6f2f4cda7b2..00000000000 --- a/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder.Clear/CS/source.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Data; -// -using System.Data.OleDb; - -class Program -{ - static void Main() - { - OleDbConnectionStringBuilder builder = - new OleDbConnectionStringBuilder(); - builder.ConnectionString = @"Data Source=c:\Sample.mdb"; - - // Call the Add method to explicitly add key/value - // pairs to the internal collection. - builder.Add("Provider", "Microsoft.Jet.Oledb.4.0"); - builder.Add("Jet OLEDB:Database Password", "MyPassword!"); - builder.Add("Jet OLEDB:System Database", @"C:\Workgroup.mdb"); - - // set up row-level locking. - builder.Add("Jet OLEDB:Database Locking Mode", 1); - - // Dump the contents of the "filled-in" - // OleDbConnectionStringBuilder - // to the console window. - DumpBuilderContents(builder); - - // Clear current values and reset known keys to their - // default values. - builder.Clear(); - - // Dump the contents of the newly emptied - // OleDbConnectionStringBuilder - // to the console window. - DumpBuilderContents(builder); - - Console.WriteLine("Press Enter to continue."); - Console.ReadLine(); - } - - private static void DumpBuilderContents(OleDbConnectionStringBuilder builder) - { - Console.WriteLine("================="); - Console.WriteLine("builder.ConnectionString = " + builder.ConnectionString); - foreach (string key in builder.Keys) - { - Console.WriteLine(key + "=" + builder[key].ToString()); - } - } -} -// diff --git a/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder.Item/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder.Item/CS/Project.csproj new file mode 100644 index 00000000000..ccdf2c3dbe0 --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder.Item/CS/Project.csproj @@ -0,0 +1,12 @@ + + + + Exe + net4.8 + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder.Item/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder.Item/CS/source.cs index fbc5fe5a81d..b5ad7718737 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder.Item/CS/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder.Item/CS/source.cs @@ -11,7 +11,6 @@ static void Main() builder.Provider = "Microsoft.Jet.Oledb.4.0"; builder.DataSource = @"C:\Sample.mdb"; // Set properties using the Item property (the indexer, in C#). - builder["Jet OLEDB:Database Password"] = "DataPassword"; builder["Jet OLEDB:Encrypt Database"] = true; builder["Jet OLEDB:System database"] = @"C:\Workgroup.mdw"; diff --git a/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.ContainsKey/CS/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.ContainsKey/CS/Project.csproj new file mode 100644 index 00000000000..56e4f6a80fe --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.ContainsKey/CS/Project.csproj @@ -0,0 +1,13 @@ + + + + Exe + net8 + + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.ContainsKey/CS/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.ContainsKey/CS/source.cs index 32e115e4e0d..28f8e499f62 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.ContainsKey/CS/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.ContainsKey/CS/source.cs @@ -1,35 +1,24 @@ using System; -using System.Data; -// -// You may need to set a reference to the System.Data.OracleClient -// assembly before you can run this sample. -using System.Data.OracleClient; +using Oracle.ManagedDataAccess.Client; class Program { static void Main() { + // OracleConnectionStringBuilder builder = - new OracleConnectionStringBuilder(GetConnectionString()); - Console.WriteLine("Connection string = " + builder.ConnectionString); + new(GetConnectionString()); + Console.WriteLine($"Connection string = '{builder.ConnectionString}'"); - // Keys you have provided return true. + // Keys you've provided return true. Console.WriteLine(builder.ContainsKey("Integrated Security")); - // Comparison is case insensitive, and synonyms for the - // keywords are translated to well-known names. - // The following returns true because "PWD" is a - // synonym for "Password", a valid key. - Console.WriteLine(builder.ContainsKey("PWD")); - // Keys that are valid but have not been set return true. Console.WriteLine(builder.ContainsKey("Unicode")); // Keys that do not exist return false. Console.WriteLine(builder.ContainsKey("MyKey")); - - Console.WriteLine("Press Enter to continue."); - Console.ReadLine(); + // } private static string GetConnectionString() @@ -39,4 +28,3 @@ private static string GetConnectionString() return "Server=OracleDemo;Integrated Security=True"; } } -// diff --git a/snippets/csharp/VS_Snippets_ADO.NET/idatareader_nextresult/cs/Project.csproj b/snippets/csharp/VS_Snippets_ADO.NET/idatareader_nextresult/cs/Project.csproj new file mode 100644 index 00000000000..1a9c4110a6a --- /dev/null +++ b/snippets/csharp/VS_Snippets_ADO.NET/idatareader_nextresult/cs/Project.csproj @@ -0,0 +1,14 @@ + + + + Exe + net8 + + + + + + + + + diff --git a/snippets/csharp/VS_Snippets_ADO.NET/idatareader_nextresult/cs/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/idatareader_nextresult/cs/source.cs index fd77b30bd3a..327ca79b93d 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/idatareader_nextresult/cs/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/idatareader_nextresult/cs/source.cs @@ -5,95 +5,102 @@ using System.Data.OleDb; using System.Data.Odbc; -class Program { - static void Main(string[] args) { - - // string connectionTypeName = "SqlClient"; - // string connectionString = @"Data Source=(local);Initial Catalog=AdventureWorks;Integrated Security=SSPI"; - - // string connectionTypeName = "Odbc"; - // string connectionString = @"Driver={SQL Server Native Client 11.0};Server=(local);Database=AdventureWorks2012;Trusted_Connection=Yes"; - - string connectionTypeName = "OleDb"; - string connectionString = @"Provider=SQLNCLI11;Data Source=(local);Initial Catalog=AdventureWorks;Integrated Security=SSPI"; - - using (IDbConnection connection = DatabaseConnectionFactory.GetConnection(connectionTypeName, connectionString)) { - IDbCommand command = connection.CreateCommand(); - command.Connection = connection; - - // these 2 queries are executed as a single batch and return 2 separate results - command.CommandText = "SELECT CountryRegionCode, Name FROM Person.CountryRegion;" + "SELECT CountryRegionCode, StateProvinceCode, Name, StateProvinceID FROM Person.StateProvince;"; - - connection.Open(); - - using (IDataReader reader = command.ExecuteReader()) { - - // process the first result - displayCountryRegions(reader); - - // use NextResult to move to the second result and verify it is returned - if (!reader.NextResult()) - throw new InvalidOperationException("Expected second result (StateProvinces) but only one was returned"); - - // process the second result - displayStateProvinces(reader); - - reader.Close(); - } - - connection.Close(); - } - } - - static void displayCountryRegions(IDataReader reader) { - if (reader.FieldCount != 2) - throw new InvalidOperationException("First resultset (CountryRegions) must contain exactly 2 columns"); - - while (reader.Read()) { - Console.WriteLine("CountryRegionCode={0}, Name={1}" - , reader.GetString(reader.GetOrdinal("CountryRegionCode")) - , reader.GetString(reader.GetOrdinal("Name"))); - } - } - - static void displayStateProvinces(IDataReader reader) { - if (reader.FieldCount != 4) - throw new InvalidOperationException("Second resultset (StateProvinces) must contain exactly 4 columns"); - - while (reader.Read()) { - Console.WriteLine("CountryRegionCode={0}, StateProvinceCode={1}, Name={2}, StateProvinceID={3}" - , reader.GetString(reader.GetOrdinal("CountryRegionCode")) - , reader.GetString(reader.GetOrdinal("StateProvinceCode")) - , reader.GetString(reader.GetOrdinal("Name")) - , reader.GetInt32(reader.GetOrdinal("StateProvinceID"))); - } - } - - class DatabaseConnectionFactory { - static SqlConnection GetSqlConnection(string connectionString) { - return new SqlConnection(connectionString); - } - - static OdbcConnection GetOdbcConnection(string connectionString) { - return new OdbcConnection(connectionString); - } - - static OleDbConnection GetOleDbConnection(string connectionString) { - return new OleDbConnection(connectionString); - } - - public static IDbConnection GetConnection(string connectionTypeName, string connectionString) { - switch (connectionTypeName) { - case "SqlClient": - return GetSqlConnection(connectionString); - case "Odbc": - return GetOdbcConnection(connectionString); - case "OleDb": - return GetOleDbConnection(connectionString); - default: - throw new ArgumentException("Value must be SqlClient, Odbc or OleDb", "connectionTypeName"); - } - } - } +class Program +{ + static void Main(string[] args) + { + string connectionTypeName = "OleDb"; + string connectionString = @"Provider=SQLNCLI11;Data Source=(local);Initial Catalog=AdventureWorks;Integrated Security=SSPI"; + + using (IDbConnection connection = DatabaseConnectionFactory.GetConnection(connectionTypeName, connectionString)) + { + IDbCommand command = connection.CreateCommand(); + command.Connection = connection; + + // these 2 queries are executed as a single batch and return 2 separate results + command.CommandText = "SELECT CountryRegionCode, Name FROM Person.CountryRegion;" + "SELECT CountryRegionCode, StateProvinceCode, Name, StateProvinceID FROM Person.StateProvince;"; + + connection.Open(); + + using (IDataReader reader = command.ExecuteReader()) + { + + // process the first result + displayCountryRegions(reader); + + // use NextResult to move to the second result and verify it is returned + if (!reader.NextResult()) + throw new InvalidOperationException("Expected second result (StateProvinces) but only one was returned"); + + // process the second result + displayStateProvinces(reader); + + reader.Close(); + } + + connection.Close(); + } + } + + static void displayCountryRegions(IDataReader reader) + { + if (reader.FieldCount != 2) + throw new InvalidOperationException("First resultset (CountryRegions) must contain exactly 2 columns"); + + while (reader.Read()) + { + Console.WriteLine("CountryRegionCode={0}, Name={1}" + , reader.GetString(reader.GetOrdinal("CountryRegionCode")) + , reader.GetString(reader.GetOrdinal("Name"))); + } + } + + static void displayStateProvinces(IDataReader reader) + { + if (reader.FieldCount != 4) + throw new InvalidOperationException("Second resultset (StateProvinces) must contain exactly 4 columns"); + + while (reader.Read()) + { + Console.WriteLine("CountryRegionCode={0}, StateProvinceCode={1}, Name={2}, StateProvinceID={3}" + , reader.GetString(reader.GetOrdinal("CountryRegionCode")) + , reader.GetString(reader.GetOrdinal("StateProvinceCode")) + , reader.GetString(reader.GetOrdinal("Name")) + , reader.GetInt32(reader.GetOrdinal("StateProvinceID"))); + } + } + + class DatabaseConnectionFactory + { + static SqlConnection GetSqlConnection(string connectionString) + { + return new SqlConnection(connectionString); + } + + static OdbcConnection GetOdbcConnection(string connectionString) + { + return new OdbcConnection(connectionString); + } + + static OleDbConnection GetOleDbConnection(string connectionString) + { + return new OleDbConnection(connectionString); + } + + public static IDbConnection GetConnection(string connectionTypeName, string connectionString) + { + switch (connectionTypeName) + { + case "SqlClient": + return GetSqlConnection(connectionString); + case "Odbc": + return GetOdbcConnection(connectionString); + case "OleDb": + return GetOleDbConnection(connectionString); + default: + throw new ArgumentException("Value must be SqlClient, Odbc, or OleDb", "connectionTypeName"); + } + } + } } -// \ No newline at end of file +// diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/CS/ConfigurationStringSettings.cs b/snippets/csharp/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/CS/ConfigurationStringSettings.cs index 516cb501693..74d4f344b27 100644 --- a/snippets/csharp/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/CS/ConfigurationStringSettings.cs +++ b/snippets/csharp/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/CS/ConfigurationStringSettings.cs @@ -1,17 +1,12 @@ // using System; -using System.Collections.Generic; using System.Configuration; using System.Web.Configuration; -using System.Collections; -using System.Text; namespace ConfigurationStringSettings { - class ConfigurationStringSettings { - static void DisplayConnectionStrings() { // Set the path of the config file. @@ -64,4 +59,4 @@ static void Main(string[] args) } } } -// \ No newline at end of file +// diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/CS/ConnectionStrings.cs b/snippets/csharp/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/CS/ConnectionStrings.cs index 17012e93d5a..5806f9c06ef 100644 --- a/snippets/csharp/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/CS/ConnectionStrings.cs +++ b/snippets/csharp/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/CS/ConnectionStrings.cs @@ -1,14 +1,12 @@ using System; using System.Configuration; -using System.Text; namespace Samples.AspNet { class ConnectionStrings { - // - // Create a connectionn string element and add it to + // Create a connection string element and add it to // the connection strings section. static ConnectionStrings() { @@ -18,20 +16,20 @@ static ConnectionStrings() ConfigurationUserLevel.None); // Get the current connection strings count. - int connStrCnt = + int connStrCnt = ConfigurationManager.ConnectionStrings.Count; - - // Create the connection string name. - string csName = + + // Create the connection string name. + string csName = "ConnStr" + connStrCnt.ToString(); // Create a connection string element and // save it to the configuration file. - + // Create a connection string element. ConnectionStringSettings csSettings = new ConnectionStringSettings(csName, - "LocalSqlServer: data source=127.0.0.1;Integrated Security=SSPI;" + + "LocalSqlServer: data source=127.0.0.1;Integrated Security=True;" + "Initial Catalog=aspnetdb", "System.Data.SqlClient"); // Get the connection strings section. @@ -40,7 +38,7 @@ static ConnectionStrings() // Add the new element. csSection.ConnectionStrings.Add(csSettings); - + // Save the configuration file. config.Save(ConfigurationSaveMode.Modified); } @@ -49,35 +47,33 @@ static ConnectionStrings() // static void ShowConnectionStrings() { - // Get the application configuration file. + // Get the application configuration file. System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration( ConfigurationUserLevel.None); // - // Get the conectionStrings section. + // Get the connectionStrings section. ConnectionStringsSection csSection = config.ConnectionStrings; - - for (int i = 0; i < + + for (int i = 0; i < ConfigurationManager.ConnectionStrings.Count; i++) { - ConnectionStringSettings cs = + ConnectionStringSettings cs = csSection.ConnectionStrings[i]; - + // - Console.WriteLine(" Connection String: \"{0}\"", - cs.ConnectionString); + Console.WriteLine($" Connection String: \"{cs.ConnectionString}\""); // - Console.WriteLine("#{0}", i); + Console.WriteLine($"#{i}"); // - Console.WriteLine(" Name: {0}", cs.Name); + Console.WriteLine($" Name: {cs.Name}"); // // - Console.WriteLine(" Provider Name: {0}", - cs.ProviderName); + Console.WriteLine($" Provider Name: {cs.ProviderName}"); // } // @@ -90,27 +86,27 @@ static void ShowConnectionStrings() // configuration file. static void AddConnectionStrings() { - + // Get the count of the connection strings. - int connStrCnt = + int connStrCnt = ConfigurationManager.ConnectionStrings.Count; - + // Define the string name. - string csName = "ConnStr" + + string csName = "ConnStr" + connStrCnt.ToString(); // Get the configuration file. System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration( ConfigurationUserLevel.None); - + // // Add the connection string. ConnectionStringsSection csSection = config.ConnectionStrings; csSection.ConnectionStrings.Add( new ConnectionStringSettings(csName, - "LocalSqlServer: data source=127.0.0.1;Integrated Security=SSPI;" + + "LocalSqlServer: data source=127.0.0.1;Integrated Security=True;" + "Initial Catalog=aspnetdb", "System.Data.SqlClient")); // @@ -135,7 +131,7 @@ static void ClearConnectionStrings() ConnectionStringsSection csSection = config.ConnectionStrings; csSection.ConnectionStrings.Clear(); - + // Save the configuration file. config.Save(ConfigurationSaveMode.Modified); @@ -168,7 +164,7 @@ static void GetIndex() int index = csCollection.IndexOf(cs); Console.WriteLine( - "Connection string settings index: {0}", + "Connection string settings index: {0}", index.ToString()); } catch (ConfigurationErrorsException err) @@ -207,7 +203,7 @@ static void RemoveConnectionStrings() // Save the configuration file. config.Save(ConfigurationSaveMode.Modified); - + Console.WriteLine( "Connection string settings removed."); } @@ -239,7 +235,7 @@ static void RemoveConnectionStrings2() csSection.ConnectionStrings; // Remove the element. - csCollection.Remove("ConnStr0"); + csCollection.Remove("ConnStr0"); // Save the configuration file. config.Save(ConfigurationSaveMode.Modified); @@ -275,7 +271,7 @@ static void RemoveConnectionStrings3() // Save the configuration file. config.Save(ConfigurationSaveMode.Modified); - + Console.WriteLine( "Connection string settings removed."); } @@ -337,7 +333,7 @@ static void GetItems2() // with the specified name. ConnectionStringSettings cs = csCollection["ConnStr0"]; - + Console.WriteLine( "cs: {0}", cs.Name); } @@ -350,7 +346,7 @@ static void GetItems2() static void Main(string[] args) { - + // Display current connection strings. // ShowConnectionStrings(); diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/CS/Project.csproj b/snippets/csharp/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/CS/Project.csproj new file mode 100644 index 00000000000..fb21df9241f --- /dev/null +++ b/snippets/csharp/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/CS/Project.csproj @@ -0,0 +1,16 @@ + + + + Library + net4.8 + + + + + + + + + + + diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.WebConfigurationManager/CS/Project.csproj b/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.WebConfigurationManager/CS/Project.csproj new file mode 100644 index 00000000000..51ddd88b23d --- /dev/null +++ b/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.WebConfigurationManager/CS/Project.csproj @@ -0,0 +1,13 @@ + + + + Exe + net4.8 + + + + + + + + diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.WebConfigurationManager/CS/WebConfigurationManager.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.WebConfigurationManager/CS/WebConfigurationManager.cs index 07da1561c3a..4311bf38fef 100644 --- a/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.WebConfigurationManager/CS/WebConfigurationManager.cs +++ b/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.WebConfigurationManager/CS/WebConfigurationManager.cs @@ -11,11 +11,11 @@ namespace Samples.Aspnet class UsingWebConfigurationManager { - // Methods to access a section at runtime. + // Methods to access a section at runtime. // - // Show how to use the GetSection(string). + // Show how to use the GetSection(string). // to access the connectionStrings section. static void GetConnectionStringsSection() { @@ -28,12 +28,12 @@ static void GetConnectionStringsSection() // Get the connectionStrings key,value pairs collection. ConnectionStringSettingsCollection connectionStrings = connectionStringsSection.ConnectionStrings; - + // Get the collection enumerator. IEnumerator connectionStringsEnum = connectionStrings.GetEnumerator(); - // Loop through the collection and + // Loop through the collection and // display the connectionStrings key, value pairs. int i = 0; Console.WriteLine("[Display the connectionStrings]"); @@ -52,14 +52,14 @@ static void GetConnectionStringsSection() // - // Show the use of GetSection(string, string). + // Show the use of GetSection(string, string). // to access the connectionStrings section. static void GetSection2() { try { - // Get the connectionStrings section for the + // Get the connectionStrings section for the // specified Web app. This GetSection overload // can olny be called from within a Web application. ConnectionStringsSection connectionStringsSection = @@ -74,7 +74,7 @@ static void GetSection2() IEnumerator connectionStringsEnum = connectionStrings.GetEnumerator(); - // Loop through the collection and + // Loop through the collection and // display the connectionStrings key, value pairs. int i = 0; Console.WriteLine("[Display connectionStrings]"); @@ -99,7 +99,7 @@ static void GetSection2() // - // Show the use of GetWebApplicationSection(string). + // Show the use of GetWebApplicationSection(string). // to get the connectionStrings section. static void GetWebApplicationSection() { @@ -117,7 +117,7 @@ static void GetWebApplicationSection() IEnumerator connectionStringsEnum = connectionStrings.GetEnumerator(); - // Loop through the collection and + // Loop through the collection and // display the connectionStrings key, value pairs. int i = 0; Console.WriteLine("[Display connectionStrings]"); @@ -150,7 +150,7 @@ static void GetConnectionStrings() IEnumerator connectionStringsEnum = connectionStrings.GetEnumerator(); - // Loop through the collection and + // Loop through the collection and // display the connectionStrings key, value pairs. int i = 0; Console.WriteLine("[Display connectionStrings]"); @@ -170,7 +170,7 @@ static void GetConnectionStrings() // // Show the use of the AppSettings property - // to get the application settings. + // to get the application settings. static void GetAppSettings() { @@ -183,7 +183,7 @@ static void GetAppSettings() IEnumerator appSettingsEnum = appSettings.GetEnumerator(); - // Loop through the collection and + // Loop through the collection and // display the appSettings key, value pairs. int i = 0; Console.WriteLine("[Display appSettings]"); @@ -200,15 +200,15 @@ static void GetAppSettings() // - // Methods to access configuration files + // Methods to access configuration files // not at runtime. These methods are // used to edit configuration files. // // Show how to use OpenMachineConfiguration(). - // It gets the machine.config file on the current - // machine and displays section information. + // It gets the machine.config file on the current + // machine and displays section information. static void OpenMachineConfiguration1() { // Get the machine.config file on the current machine. @@ -228,7 +228,7 @@ static void OpenMachineConfiguration1() Console.WriteLine("[Total number of sections: {0}]", i); // Display machine.config path. - Console.WriteLine("[File path: {0}]", config.FilePath); + Console.WriteLine("[File path: {0}]", config.FilePath); } // @@ -236,13 +236,13 @@ static void OpenMachineConfiguration1() // // Show how to use OpenMachineConfiguration(string). - // It gets the machine.config file applicabe to the - // specified resource and displays section - // basic information. + // It gets the machine.config file applicable to the + // specified resource and displays section + // basic information. static void OpenMachineConfiguration2() { - // Get the machine.config file applicabe to the - // specified reosurce. + // Get the machine.config file applicable to the + // specified resource. System.Configuration.Configuration config = WebConfigurationManager.OpenMachineConfiguration("configTest"); @@ -268,14 +268,14 @@ static void OpenMachineConfiguration2() // Show how to use OpenMachineConfiguration(string, string). // It gets the machine.config file on the specified server and - // applicabe to the specified reosurce and displays section - // basic information. + // applicable to the specified resource and displays section + // basic information. static void OpenMachineConfiguration3() { - // Get the machine.config file applicabe to the - // specified reosurce and on the specified server. + // Get the machine.config file applicable to the + // specified resource and on the specified server. System.Configuration.Configuration config = - WebConfigurationManager.OpenMachineConfiguration("configTest", + WebConfigurationManager.OpenMachineConfiguration("configTest", "myServer"); // Loop to get the sections. Display basic information. @@ -300,16 +300,16 @@ static void OpenMachineConfiguration3() // Show how to use OpenMachineConfiguration(string, string). // It gets the machine.config file on the specified server, - // applicabe to the specified reosurce, for the specified user - // and displays section basic information. + // applicable to the specified resource, for the specified user + // and displays section basic information. static void OpenMachineConfiguration4() { // Get the current user token. IntPtr userToken = System.Security.Principal.WindowsIdentity.GetCurrent().Token; - // Get the machine.config file applicabe to the - // specified reosurce, on the specified server for the + // Get the machine.config file applicable to the + // specified resource, on the specified server for the // specified user. System.Configuration.Configuration config = WebConfigurationManager.OpenMachineConfiguration("configTest", @@ -337,8 +337,8 @@ static void OpenMachineConfiguration4() // Show how to use OpenMachineConfiguration(string, string). // It gets the machine.config file on the specified server, - // applicabe to the specified reosurce, for the specified user - // and displays section basic information. + // applicable to the specified resource, for the specified user + // and displays section basic information. static void OpenMachineConfiguration5() { // Set the user id and password. @@ -347,8 +347,8 @@ static void OpenMachineConfiguration5() // Substitute with actual password. string password = "userPassword"; - // Get the machine.config file applicabe to the - // specified reosurce, on the specified server for the + // Get the machine.config file applicable to the + // specified resource, on the specified server for the // specified user. System.Configuration.Configuration config = WebConfigurationManager.OpenMachineConfiguration("configTest", @@ -375,15 +375,15 @@ static void OpenMachineConfiguration5() // // Show how to use OpenWebConfiguration(string). - // It gets he appSettings section of a Web application - // runnig on the local server. + // It gets he appSettings section of a Web application + // runnig on the local server. static void OpenWebConfiguration1() { // Get the configuration object for a Web application - // running on the local server. + // running on the local server. System.Configuration.Configuration config = - WebConfigurationManager.OpenWebConfiguration("/configTest") - as System.Configuration.Configuration; + WebConfigurationManager.OpenWebConfiguration("/configTest") + as System.Configuration.Configuration; // Get the appSettings. KeyValueConfigurationCollection appSettings = @@ -406,14 +406,14 @@ static void OpenWebConfiguration1() // // Show how to use OpenWebConfiguration(string, string). - // It gets he appSettings section of a Web application - // runnig on the local server. + // It gets he appSettings section of a Web application + // runnig on the local server. static void OpenWebConfiguration2() { // Get the configuration object for a Web application - // running on the local server. + // running on the local server. System.Configuration.Configuration config = - WebConfigurationManager.OpenWebConfiguration("/configTest", + WebConfigurationManager.OpenWebConfiguration("/configTest", "Default Web Site") as System.Configuration.Configuration; @@ -441,12 +441,12 @@ static void OpenWebConfiguration2() // // Show how to use OpenWebConfiguration(string, string, string). - // It gets he appSettings section of a Web application - // runnig on the local server. + // It gets he appSettings section of a Web application + // runnig on the local server. static void OpenWebConfiguration3() { // Get the configuration object for a Web application - // running on the local server. + // running on the local server. System.Configuration.Configuration config = WebConfigurationManager.OpenWebConfiguration( "/configTest", "Default Web Site", null) @@ -462,7 +462,7 @@ static void OpenWebConfiguration3() "[appSettings for app at: /configTest"); Console.WriteLine(" site: Default Web Site"); Console.WriteLine(" and locationSubPath: null]"); - + foreach (string key in appSettings.AllKeys) { Console.WriteLine("Name: {0} Value: {1}", @@ -476,22 +476,22 @@ static void OpenWebConfiguration3() // - // Show how to use OpenWebConfiguration(string, string, + // Show how to use OpenWebConfiguration(string, string, // string, string). - // It gets he appSettings section of a Web application - // running on the specified server. + // It gets he appSettings section of a Web application + // running on the specified server. // If the server is remote your application must have the - // required access rights to the configuration file. + // required access rights to the configuration file. static void OpenWebConfiguration4() { // Get the configuration object for a Web application // running on the specified server. - // Null for the subPath signifies no subdir. + // Null for the subPath signifies no subdir. System.Configuration.Configuration config = WebConfigurationManager.OpenWebConfiguration( "/configTest", "Default Web Site", null, "myServer") as System.Configuration.Configuration; - + // Get the appSettings. KeyValueConfigurationCollection appSettings = config.AppSettings.Settings; @@ -512,18 +512,18 @@ static void OpenWebConfiguration4() // - // Show how to use OpenWebConfiguration(string, string, + // Show how to use OpenWebConfiguration(string, string, // string, string, string, string). - // It gets he appSettings section of a Web application - // running on a remote server. + // It gets he appSettings section of a Web application + // running on a remote server. // If the server is remote your application must have the - // required access rights to the configuration file. + // required access rights to the configuration file. static void OpenWebConfiguration5() { // Get the current user. string user = System.Security.Principal.WindowsIdentity.GetCurrent().Name; - + // Assign the actual password. string password = "userPassword"; @@ -554,26 +554,26 @@ static void OpenWebConfiguration5() // - // Show how to use OpenWebConfiguration(string, string, + // Show how to use OpenWebConfiguration(string, string, // string, string, IntPtr). - // It gets he appSettings section of a Web application - // running on a remote server. + // It gets he appSettings section of a Web application + // running on a remote server. // If the serve is remote your application shall have the - // requires access rights to the configuration file. + // requires access rights to the configuration file. static void OpenWebConfiguration6() { - IntPtr userToken = + IntPtr userToken = System.Security.Principal.WindowsIdentity.GetCurrent().Token; - - string user = + + string user = System.Security.Principal.WindowsIdentity.GetCurrent().Name; - + // Get the configuration object for a Web application // running on a remote server. System.Configuration.Configuration config = WebConfigurationManager.OpenWebConfiguration( - "/configTest", "Default Web Site", null, + "/configTest", "Default Web Site", null, "myServer", userToken) as System.Configuration.Configuration; // Get the appSettings. @@ -597,7 +597,7 @@ static void OpenWebConfiguration6() // // Utility to map virtual directories to physical ones. - // In the current physical directory maps + // In the current physical directory maps // a physical sub-directory with its virtual directory. // A web.config file is created for the // default and the virtual directory at the appropriate level. @@ -611,24 +611,24 @@ static WebConfigurationFileMap CreateFileMap() // Get he physical directory where this app runs. // We'll use it to map the virtual directories - // defined next. + // defined next. string physDir = Environment.CurrentDirectory; // Create a VirtualDirectoryMapping object to use // as the root directory for the virtual directory - // named config. + // named config. // Note: you must assure that you have a physical subdirectory // named config in the curremt physical directory where this // application runs. - VirtualDirectoryMapping vDirMap = + VirtualDirectoryMapping vDirMap = new VirtualDirectoryMapping(physDir + "\\config", true); - // Add vDirMap to the VirtualDirectories collection + // Add vDirMap to the VirtualDirectories collection // assigning to it the virtual directory name. fileMap.VirtualDirectories.Add("/config", vDirMap); // Create a VirtualDirectoryMapping object to use - // as the default directory for all the virtual + // as the default directory for all the virtual // directories. VirtualDirectoryMapping vDirMapBase = new VirtualDirectoryMapping(physDir, true, "web.config"); @@ -636,15 +636,15 @@ static WebConfigurationFileMap CreateFileMap() // Add it to the virtual directory mapping collection. fileMap.VirtualDirectories.Add("/", vDirMapBase); -# if DEBUG +# if DEBUG // Test at debug time. foreach (string key in fileMap.VirtualDirectories.AllKeys) { Console.WriteLine("Virtual directory: {0} Physical path: {1}", - fileMap.VirtualDirectories[key].VirtualDirectory, + fileMap.VirtualDirectories[key].VirtualDirectory, fileMap.VirtualDirectories[key].PhysicalDirectory); } -# endif +# endif // Return the mapping. return fileMap; @@ -660,7 +660,7 @@ static void OpenMappedWebConfiguration1() { // Create the configuration directories mapping. - WebConfigurationFileMap fileMap = + WebConfigurationFileMap fileMap = CreateFileMap(); try @@ -669,10 +669,10 @@ static void OpenMappedWebConfiguration1() // Get the Configuration object for the mapped // virtual directory. System.Configuration.Configuration config = - WebConfigurationManager.OpenMappedWebConfiguration(fileMap, + WebConfigurationManager.OpenMappedWebConfiguration(fileMap, "/config"); - // Define a nique key for the creation of + // Define a nique key for the creation of // an appSettings element entry. int appStgCnt = config.AppSettings.Settings.Count; string asName = "AppSetting" + appStgCnt.ToString(); @@ -684,12 +684,12 @@ static void OpenMappedWebConfiguration1() // Save to the configuration file. config.Save(ConfigurationSaveMode.Modified); - + // Display new appSettings. Console.WriteLine("Count: [{0}]", config.AppSettings.Settings.Count); foreach (string key in config.AppSettings.Settings.AllKeys) - { - Console.WriteLine("[{0}] = [{1}]", key, + { + Console.WriteLine("[{0}] = [{1}]", key, config.AppSettings.Settings[key].Value); } } @@ -719,11 +719,11 @@ static void OpenMappedWebConfiguration2() // Get the Configuration object for the mapped // virtual directory. - System.Configuration.Configuration config = + System.Configuration.Configuration config = WebConfigurationManager.OpenMappedWebConfiguration( fileMap, "/config", "config"); - - // Define a nique key for the creation of + + // Define a nique key for the creation of // an appSettings element entry. int appStgCnt = config.AppSettings.Settings.Count; string asName = "AppSetting" + appStgCnt.ToString(); @@ -737,7 +737,7 @@ static void OpenMappedWebConfiguration2() config.Save(ConfigurationSaveMode.Modified); // Display new appSettings. - Console.WriteLine("Count: [{0}]", + Console.WriteLine("Count: [{0}]", config.AppSettings.Settings.Count); foreach (string key in config.AppSettings.Settings.AllKeys) { @@ -775,7 +775,7 @@ static void OpenMappedWebConfiguration3() WebConfigurationManager.OpenMappedWebConfiguration( fileMap, "/config", "config", "config"); - // Define a nique key for the creation of + // Define a unique key for the creation of // an appSettings element entry. int appStgCnt = config.AppSettings.Settings.Count; string asName = "AppSetting" + appStgCnt.ToString(); @@ -789,7 +789,7 @@ static void OpenMappedWebConfiguration3() config.Save(ConfigurationSaveMode.Modified); // Display new appSettings. - Console.WriteLine("Count: [{0}]", + Console.WriteLine("Count: [{0}]", config.AppSettings.Settings.Count); foreach (string key in config.AppSettings.Settings.AllKeys) { @@ -825,7 +825,7 @@ static void Main(string[] args) case "0": GetConnectionStringsSection(); break; - + case "1": GetSection2(); break; @@ -861,19 +861,19 @@ static void Main(string[] args) case "9": OpenWebConfiguration2(); break; - + case "10": OpenWebConfiguration3(); break; - + case "11": OpenWebConfiguration4(); break; - + case "12": OpenWebConfiguration5(); break; - + case "13": OpenWebConfiguration6(); break; @@ -893,7 +893,7 @@ static void Main(string[] args) case "17": GetAppSettings(); break; - + case "18": GetConnectionStrings(); break; @@ -907,4 +907,4 @@ static void Main(string[] args) } } } -// \ No newline at end of file +// diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSource_22sql/CS/sql22cs.aspx b/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSource_22sql/CS/sql22cs.aspx deleted file mode 100644 index 46f7cc80601..00000000000 --- a/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSource_22sql/CS/sql22cs.aspx +++ /dev/null @@ -1,88 +0,0 @@ - -<%@Page Language="C#" %> -<%@Import Namespace="System.Data" %> -<%@Import Namespace="System.Data.Common" %> - - - - - - - - - ASP.NET Example - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/xml/System.Configuration/ConfigurationManager.xml b/xml/System.Configuration/ConfigurationManager.xml index f1f2191ca87..c125e168d24 100644 --- a/xml/System.Configuration/ConfigurationManager.xml +++ b/xml/System.Configuration/ConfigurationManager.xml @@ -212,21 +212,6 @@ Module Module1 End Sub End Module -``` - - The previous example assumes your project has an App.config file as shown below. - -```xml - - - - - - - - - - ``` The following example shows how to use a connection string to read data from a database. @@ -291,20 +276,6 @@ Module Module1 End Sub End Module -``` - - The previous example assumes your project has an App.config as shown below. - -```xml - - - - - - - - - ``` ]]> @@ -510,21 +481,6 @@ Module Module1 End Sub End Module -``` - - The previous example assumes your project has an App.config file as shown below. - -```xml - - - - - - - - - - ``` ]]> @@ -632,20 +588,6 @@ Module Module1 End Sub End Module -``` - - The previous example assumes your project has an App.config as shown below. - -```xml - - - - - - - - - ``` ]]> diff --git a/xml/System.Configuration/ConnectionStringSettingsCollection.xml b/xml/System.Configuration/ConnectionStringSettingsCollection.xml index 8017ad75fc0..7c766ea57ac 100644 --- a/xml/System.Configuration/ConnectionStringSettingsCollection.xml +++ b/xml/System.Configuration/ConnectionStringSettingsCollection.xml @@ -38,31 +38,17 @@ Contains a collection of objects. - object contains a collection of objects. Each object represents a single entry in the `` configuration-file section. - - - -## Examples - The following example shows how to access the . - + object contains a collection of objects. Each object represents a single entry in the `` configuration-file section. + +## Examples + The following example shows how to access the . + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/CS/ConnectionStrings.cs" id="Snippet2"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/VB/ConnectionStrings.vb" id="Snippet2"::: - - The following example is an excerpt from the configuration file used by the previous example. - -```xml - - - - - - -``` - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/VB/ConnectionStrings.vb" id="Snippet2"::: + ]]> @@ -130,14 +116,14 @@ A object to add to the collection. Adds a object to the collection. - object to a collection. - + object to a collection. + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/CS/ConnectionStrings.cs" id="Snippet7"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/VB/ConnectionStrings.vb" id="Snippet7"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/VB/ConnectionStrings.vb" id="Snippet7"::: + ]]> @@ -210,19 +196,19 @@ Removes all the objects from the collection. - method removes all the connection strings from the configuration file at the current configuration hierarchy level and writes a `` tag in the file. The `` tag signifies that all the connection strings defined in the parent configuration files are disregarded by the system. - - - -## Examples - The following example shows how to remove all the objects from the collection. - + method removes all the connection strings from the configuration file at the current configuration hierarchy level and writes a `` tag in the file. The `` tag signifies that all the connection strings defined in the parent configuration files are disregarded by the system. + + + +## Examples + The following example shows how to remove all the objects from the collection. + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/CS/ConnectionStrings.cs" id="Snippet9"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/VB/ConnectionStrings.vb" id="Snippet9"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/VB/ConnectionStrings.vb" id="Snippet9"::: + ]]> @@ -331,14 +317,14 @@ Returns the collection index of the passed object. The collection index of the specified object. - object. - + object. + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/CS/ConnectionStrings.cs" id="Snippet10"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/VB/ConnectionStrings.vb" id="Snippet10"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/VB/ConnectionStrings.vb" id="Snippet10"::: + ]]> @@ -388,19 +374,19 @@ Gets or sets the connection string at the specified index in the collection. The object at the specified index. - class. - - - -## Examples - The following example shows how to access a object at a given index in a collection. - + class. + + + +## Examples + The following example shows how to access a object at a given index in a collection. + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/CS/ConnectionStrings.cs" id="Snippet14"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/VB/ConnectionStrings.vb" id="Snippet14"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/VB/ConnectionStrings.vb" id="Snippet14"::: + ]]> @@ -440,19 +426,19 @@ Gets or sets the object with the specified name in the collection. The object with the specified name; otherwise, . - class. - - - -## Examples - The following example shows how to access a named object in a collection. - + class. + + + +## Examples + The following example shows how to access a named object in a collection. + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/CS/ConnectionStrings.cs" id="Snippet15"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/VB/ConnectionStrings.vb" id="Snippet15"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/VB/ConnectionStrings.vb" id="Snippet15"::: + ]]> @@ -536,14 +522,14 @@ A object in the collection. Removes the specified object from the collection. - object from the collection. - + object from the collection. + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/CS/ConnectionStrings.cs" id="Snippet11"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/VB/ConnectionStrings.vb" id="Snippet11"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/VB/ConnectionStrings.vb" id="Snippet11"::: + ]]> @@ -582,14 +568,14 @@ The name of a object in the collection. Removes the specified object from the collection. - object with the specified name from the collection. - + object with the specified name from the collection. + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/CS/ConnectionStrings.cs" id="Snippet12"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/VB/ConnectionStrings.vb" id="Snippet12"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/VB/ConnectionStrings.vb" id="Snippet12"::: + ]]> @@ -628,14 +614,14 @@ The index of a object in the collection. Removes the object at the specified index in the collection. - object at the specified index in the collection. - + object at the specified index in the collection. + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/CS/ConnectionStrings.cs" id="Snippet13"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/VB/ConnectionStrings.vb" id="Snippet13"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/VB/ConnectionStrings.vb" id="Snippet13"::: + ]]> diff --git a/xml/System.Configuration/ConnectionStringsSection.xml b/xml/System.Configuration/ConnectionStringsSection.xml index 21b889e13d0..94f683ce0be 100644 --- a/xml/System.Configuration/ConnectionStringsSection.xml +++ b/xml/System.Configuration/ConnectionStringsSection.xml @@ -32,31 +32,19 @@ Provides programmatic access to the connection strings configuration-file section. - class allows you to programmatically modify the `connectionStrings` section of the configuration file. The connection strings are provided as a of `add` configuration elements. - - - -## Examples - The following example shows how to use the . - + class allows you to programmatically modify the `connectionStrings` section of the configuration file. The connection strings are provided as a of `add` configuration elements. + + + +## Examples + The following example shows how to use the . + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/CS/ConnectionStrings.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/VB/ConnectionStrings.vb" id="Snippet1"::: - - The following excerpt shows the configuration used by the previous example. - -```xml - - - - - - -``` - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/VB/ConnectionStrings.vb" id="Snippet1"::: + ]]> @@ -127,14 +115,14 @@ Gets a collection of objects. A collection of objects. - property of the object. - + property of the object. + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/CS/ConnectionStrings.cs" id="Snippet2"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/VB/ConnectionStrings.vb" id="Snippet2"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Configuration.ConnectionStrings/VB/ConnectionStrings.vb" id="Snippet2"::: + ]]> diff --git a/xml/System.Configuration/ProtectedConfigurationProvider.xml b/xml/System.Configuration/ProtectedConfigurationProvider.xml index 262ed3b7187..94c905d2aa3 100644 --- a/xml/System.Configuration/ProtectedConfigurationProvider.xml +++ b/xml/System.Configuration/ProtectedConfigurationProvider.xml @@ -61,33 +61,6 @@ You can encrypt sections of a configuration file to protect sensitive informatio :::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Configuration.UsingProtectedConfigurationProvider/CS/ProtectedConfigurationProvider.cs" id="Snippet11"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Configuration.UsingProtectedConfigurationProvider/VB/ProtectedConfigurationProvider.vb" id="Snippet11"::: - The following is an excerpt of the configuration file used by the above examples. - -[!INCLUDE[ROPC warning](~/includes/ropc-warning.md)] - -```xml - - - - - - - - - - - - - - - - -``` - ]]> diff --git a/xml/System.Data.Common/DbConnectionStringBuilder.xml b/xml/System.Data.Common/DbConnectionStringBuilder.xml index 426afec405c..da880354bcf 100644 --- a/xml/System.Data.Common/DbConnectionStringBuilder.xml +++ b/xml/System.Data.Common/DbConnectionStringBuilder.xml @@ -81,17 +81,17 @@ ## Remarks The class provides the base class from which the strongly typed connection string builders (, , and so on) derive. The connection string builders let developers programmatically create syntactically correct connection strings, and parse and rebuild existing connection strings. - The has been defined in a database-agnostic manner. Because of the addition of the namespace, developers require a base class against which they can program in order to build connection strings that can work against an arbitrary database. Therefore, the class lets users assign arbitrary key/value pairs and pass the resulting connection string to a strongly typed provider. All the data providers that are included as part of the .NET Framework provide a strongly typed class that inherits from : , , , and . + The has been defined in a database-agnostic manner. Because of the addition of the namespace, developers require a base class against which they can program in order to build connection strings that can work against an arbitrary database. Therefore, the class lets users assign arbitrary key/value pairs and pass the resulting connection string to a strongly typed provider. All the data providers that are included as part of .NET offer a strongly typed class that inherits from : , , , and . - The developer can build, assign, and edit connection strings for any arbitrary provider. For providers that support specific key/value pairs, the connection string builder provides strongly typed properties corresponding to the known pairs. In order to support providers that require the ability to support unknown values, developers can also supply arbitrary key/value pairs. +You can build, assign, and edit connection strings for any arbitrary provider. For providers that support specific key/value pairs, the connection string builder provides strongly typed properties corresponding to the known pairs. For providers that require the ability to support unknown values, you can also supply arbitrary key/value pairs. - The class implements the interface. This means that the class works with Visual Studio designers at design time. When developers use the designer to build strongly typed DataSets and strongly typed connections within Visual Studio, the strongly typed connection string builder class will display the properties associated with its type and will also have converters that can map common values for known keys. + The class implements the interface. This means that the class works with Visual Studio designers at design time. When developers use the designer to build strongly typed DataSets and strongly typed connections within Visual Studio, the strongly typed connection string builder class displays the properties associated with its type and also has converters that can map common values for known keys. - Developers needing to create connection strings as part of applications can use the class or one of its strongly typed derivatives to build and modify connection strings. The class also makes it easy to manage connection strings stored in an application configuration file. +If you need to create connection strings as part of applications, use the class or one of its strongly typed derivatives to build and modify connection strings. The class also makes it easy to manage connection strings stored in an application configuration file. - Developers can create connection strings using either a strongly typed connection string builder class, or they can use the class. The performs no checks for valid key/value pairs. Therefore, it is possible using this class to create invalid connection strings. The supports only key/value pairs that are supported by SQL Server; trying to add invalid pairs will throw an exception. +You can create connection strings using either a strongly typed connection string builder class or the class. The performs no checks for valid key/value pairs. Therefore, it's possible to create invalid connection strings when using this class. The supports only key/value pairs that are supported by SQL Server; trying to add invalid pairs will throw an exception. - Both the method and property handle tries to insert malicious entries. For example, the following code correctly escapes the nested key/value pair: + Both the method and property handle cases where a bad actor tries to insert malicious entries. For example, the following code correctly escapes the nested key/value pair: ```vb Dim builder As New System.Data.Common.DbConnectionStringBuilder @@ -277,17 +277,6 @@ initial catalog="AdventureWorks;NewValue=Bad" Calling the method by passing a null (`Nothing` in Visual Basic) key throws an . However, calling the method by passing a null value removes the key/value pair. - - -## Examples - The following example creates a new and adds items. The code also demonstrates overwriting an existing item using the method, and includes a commented block that would throw an . - -> [!NOTE] -> This example includes a password to demonstrate how works with connection strings. In your applications, we recommend that you use Windows Authentication. If you must use a password, do not include a hard-coded password in your application. - - :::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.Add/CS/source.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.Add/VB/source.vb" id="Snippet1"::: - ]]> diff --git a/xml/System.Data.EntityClient/EntityConnectionStringBuilder.xml b/xml/System.Data.EntityClient/EntityConnectionStringBuilder.xml index dc30eb1f20d..fec11ab1fbc 100644 --- a/xml/System.Data.EntityClient/EntityConnectionStringBuilder.xml +++ b/xml/System.Data.EntityClient/EntityConnectionStringBuilder.xml @@ -115,17 +115,11 @@ The invariant Provider name must be specified in the `connectionString` parameter. Supported providers include the following: - `System.Data.Odbc` - - `System.Data.OleDb` - - `System.Data.OracleClient` - - `System.Data.SqlClient` - - `Microsoft.SqlServerCe.Client` - - ## Examples The following example demonstrates how to use the in conjunction with a . The code sets properties of a `SqlConnectionStringBuilder` to create a connection string that supplies part of the underlying provider connection string. Note that the Provider name cannot be set using the `SqlConnectionStringBuilder` because it is not valid `SqlConnection` connection string syntax. The code creates the connection string by setting `EntityConnectionStringBuilder` properties. It does not use the `connectionString` overload. diff --git a/xml/System.Data.Odbc/OdbcConnectionStringBuilder.xml b/xml/System.Data.Odbc/OdbcConnectionStringBuilder.xml index 655c55c8a0e..1ffc5b4e4ca 100644 --- a/xml/System.Data.Odbc/OdbcConnectionStringBuilder.xml +++ b/xml/System.Data.Odbc/OdbcConnectionStringBuilder.xml @@ -82,8 +82,6 @@ Console.WriteLine(builder.ConnectionString); Driver={SQL Server};Server="MyServer;NewValue=Bad" ``` - - ## Examples The following console application builds connection strings for several ODBC databases. First, the example creates a connection string for a Microsoft Access database. It then creates a connection string for an IBM DB2 database. The example also parses an existing connection string, and demonstrates various ways of manipulating the contents of the connection string. diff --git a/xml/System.Data.OleDb/OleDbConnectionStringBuilder.xml b/xml/System.Data.OleDb/OleDbConnectionStringBuilder.xml index 49ffe1f162d..329b474dcc4 100644 --- a/xml/System.Data.OleDb/OleDbConnectionStringBuilder.xml +++ b/xml/System.Data.OleDb/OleDbConnectionStringBuilder.xml @@ -231,17 +231,6 @@ Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Sample.mdb;User ID="Admin;NewVal ## Remarks The method removes all key/value pairs from the , and resets all corresponding properties to their default values. This includes setting the property to 0, and setting the property to an empty string. - - -## Examples - The following example demonstrates the effect of calling the method. This example populates the with some key/value pairs, and then calls the method and shows the results. - -> [!NOTE] -> This example includes a password to demonstrate how works with connection strings. In your applications, we recommend that you use Windows Authentication. If you must use a password, do not include a hard-coded password in your application. - - :::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder.Clear/CS/source.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder.Clear/VB/source.vb" id="Snippet1"::: - ]]> Connection String Builders diff --git a/xml/System.Data.OracleClient/OracleConnectionStringBuilder.xml b/xml/System.Data.OracleClient/OracleConnectionStringBuilder.xml index 28fb325e03b..a2d039681a5 100644 --- a/xml/System.Data.OracleClient/OracleConnectionStringBuilder.xml +++ b/xml/System.Data.OracleClient/OracleConnectionStringBuilder.xml @@ -31,54 +31,45 @@ Provides a simple way to create and manage the contents of connection strings used by the class. - class implements the interface. This means that the class works with Visual Studio .NET designers at design time. When developers use the designer to build strongly typed **DataSets** and strongly typed connections within Visual Studio .NET, the strongly typed connection string builder class will display the properties associated with its type and will also have converters that can map common values for known keys. - - Developers needing to create connection strings as part of applications can use the class to build and modify connection strings. The class also makes it easy to manage connection strings stored in an application configuration file. - - The performs checks for valid key/value pairs. Therefore, this class cannot be used to create invalid connection strings. Trying to add invalid pairs will throw an exception. The class maintains a fixed collection of synonyms, and when required, can perform the required translation to convert from a synonym to the corresponding well-known key name. For example, when you use the property to retrieve a value, you can specify a string that contains any synonym for the key you need. See the property for a full list of acceptable synonyms. - - The handles attempts to insert malicious entries. For example, the following code, using the default property (the indexer, in C#) correctly escapes the nested key/value pair. - + class implements the interface. This means that the class works with Visual Studio .NET designers at design time. When developers use the designer to build strongly typed **DataSets** and strongly typed connections within Visual Studio .NET, the strongly typed connection string builder class will display the properties associated with its type and will also have converters that can map common values for known keys. + + Developers needing to create connection strings as part of applications can use the class to build and modify connection strings. The class also makes it easy to manage connection strings stored in an application configuration file. + + The performs checks for valid key/value pairs. Therefore, this class cannot be used to create invalid connection strings. Trying to add invalid pairs will throw an exception. The class maintains a fixed collection of synonyms, and when required, can perform the required translation to convert from a synonym to the corresponding well-known key name. For example, when you use the property to retrieve a value, you can specify a string that contains any synonym for the key you need. See the property for a full list of acceptable synonyms. + + The handles attempts to insert malicious entries. For example, the following code, using the default property (the indexer, in C#), correctly escapes the nested key/value pair. + ```vb -Dim builder As New System.Data. _ - OracleClient.OracleConnectionStringBuilder -builder("Data Source") = "OracleDemo" -builder("Integrated Security") = True -builder("User ID") = "Mary;NewValue=Bad" -System.Diagnostics.Debug.WriteLine(builder.ConnectionString) -``` - +Dim builder As New System.Data. _ + OracleClient.OracleConnectionStringBuilder +builder("Data Source") = "OracleDemo;NewValue=Bad" +builder("Integrated Security") = True +builder("User ID") = "Mary;NewValue=Bad" +System.Diagnostics.Debug.WriteLine(builder.ConnectionString) +``` + ```csharp -System.Data.OracleClient.OracleConnectionStringBuilder builder = - new System.Data.OracleClient.OracleConnectionStringBuilder(); -builder["Data Source"] = "OracleDemo"; -builder["integrated Security"] = true; -builder["User ID"] = "Mary;NewValue=Bad"; -System.Diagnostics.Debug.WriteLine(builder.ConnectionString); -``` - - The result is the following connection string that handles the invalid value in a safe manner by enclosing the User ID value in quotes: - -``` -Data Source=OracleDemo;Integrated Security=True;User ID="Mary;NewValue=Bad" -``` - - - -## Examples - The following console application builds connection strings for an Oracle database. The code uses an class to create the connection string, and then passes the property of the instance to the constructor of the connection class. The example also parses an existing connection string, and demonstrates various ways of manipulating the connection string's contents. - -> [!NOTE] -> This example includes a password to demonstrate how works with connection strings. In your applications, we recommend that you use Windows Authentication. If you must use a password, do not include a hard-coded password in your application. - - :::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder/CS/source.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder/VB/source.vb" id="Snippet1"::: - +System.Data.OracleClient.OracleConnectionStringBuilder builder = + new System.Data.OracleClient.OracleConnectionStringBuilder(); +builder["Data Source"] = "OracleDemo"; +builder["integrated Security"] = true; +builder["User ID"] = "Mary;NewValue=Bad"; +System.Diagnostics.Debug.WriteLine(builder.ConnectionString); +``` + + The result is the following connection string that handles the invalid value in a safe manner by enclosing the User ID value in quotes: + +``` +Data Source=OracleDemo;Integrated Security=True;User ID="Mary;NewValue=Bad" +``` + +[!INCLUDE[ROPC warning](~/includes/ropc-warning.md)] + ]]> Building Connection Strings @@ -132,22 +123,22 @@ Data Source=OracleDemo;Integrated Security=True;User ID="Mary;NewValue=Bad" The basis for the object's internal connection information. Parsed into name/value pairs. Invalid key names raise a . Initializes a new instance of the class. The provided connection string provides the data for the instance's internal connection information. - class provides a fixed internal collection of key/value pairs. Even if you supply only a small subset of the possible connection string values in the constructor, the object always provides default values for each key/value pair. When the property of the object is retrieved, the string contains only key/value pairs in which the value is different from the default value for the item. - - - -## Examples - The following example supplies a simple connection string in the object's constructor, and then iterates through all the key/value pairs within the object. Note that the collection provides default values for each items. Also note that the class converts synonyms for the well-known keys so that they are consistent with the well-known names. - + class provides a fixed internal collection of key/value pairs. Even if you supply only a small subset of the possible connection string values in the constructor, the object always provides default values for each key/value pair. When the property of the object is retrieved, the string contains only key/value pairs in which the value is different from the default value for the item. + + + +## Examples + The following example supplies a simple connection string in the object's constructor, and then iterates through all the key/value pairs within the object. Note that the collection provides default values for each items. Also note that the class converts synonyms for the well-known keys so that they are consistent with the well-known names. + > [!NOTE] -> This example includes a password to demonstrate how works with connection strings. In your applications, we recommend that you use Windows Authentication. If you must use a password, do not include a hard-coded password in your application. - +> This example includes a password to demonstrate how works with connection strings. In your applications, we recommend that you use Windows Authentication. If you must use a password, do not include a hard-coded password in your application. + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.Ctor/CS/source.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.Ctor/VB/source.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.Ctor/VB/source.vb" id="Snippet1"::: + ]]> Invalid key name within the connection string. @@ -175,19 +166,19 @@ Data Source=OracleDemo;Integrated Security=True;User ID="Mary;NewValue=Bad" Clears the contents of the instance. - method removes all key/value pairs from the , and resets all corresponding properties. This includes resetting the connection string to an empty string. - - - -## Examples - The following example demonstrates the effect of calling the method. This example populates the with some key/value pairs, and then calls the method and shows the results. - + method removes all key/value pairs from the , and resets all corresponding properties. This includes resetting the connection string to an empty string. + + + +## Examples + The following example demonstrates the effect of calling the method. This example populates the with some key/value pairs, and then calls the method and shows the results. + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.Clear/CS/source.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.Clear/VB/source.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.Clear/VB/source.vb" id="Snippet1"::: + ]]> Building Connection Strings @@ -218,19 +209,19 @@ Data Source=OracleDemo;Integrated Security=True;User ID="Mary;NewValue=Bad" if the contains an element that has the specified key; otherwise, . - contains a fixed-size collection of key/value pairs, the method determines only if a particular key name is valid. - - - -## Examples - The following example creates an instance, sets some of its properties, and then tries to determine whether various keys exist within the object by calling the method. - + contains a fixed-size collection of key/value pairs, the method determines only if a particular key name is valid. + + + +## Examples + The following example creates an instance, sets some of its properties, and then tries to determine whether various keys exist within the object by calling the method. + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.ContainsKey/CS/source.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.ContainsKey/VB/source.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.ContainsKey/VB/source.vb" id="Snippet1"::: + ]]> @@ -268,19 +259,19 @@ Data Source=OracleDemo;Integrated Security=True;User ID="Mary;NewValue=Bad" Gets or sets the name of the Oracle data source to connect to. The value of the property, or if none has been supplied. - will use the well-known "Data Source" key. If the value passed in is null when you try to set the property, the property is reset. If the value has not been set and the developer tries to retrieve the property, the return value is . - - - -## Examples - The following example demonstrates that the class converts synonyms for the "Data Source" connection string key into the well-known key. - + will use the well-known "Data Source" key. If the value passed in is null when you try to set the property, the property is reset. If the value has not been set and the developer tries to retrieve the property, the return value is . + + + +## Examples + The following example demonstrates that the class converts synonyms for the "Data Source" connection string key into the well-known key. + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.DataSource/CS/source.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.DataSource/VB/source.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.DataSource/VB/source.vb" id="Snippet1"::: + ]]> Building Connection Strings @@ -316,11 +307,11 @@ Data Source=OracleDemo;Integrated Security=True;User ID="Mary;NewValue=Bad" Gets or sets a value that indicates whether the pooler automatically enlists the connection in the creation thread's current transaction context. The value of the property, or if the property has not been previously set. - Building Connection Strings @@ -381,22 +372,22 @@ Data Source=OracleDemo;Integrated Security=True;User ID="Mary;NewValue=Bad" Gets or sets a value that indicates whether "User ID" and "Password" are specified in the connection (when ) or whether the current Windows account credentials are used for authentication (when ). The value of the property, or a if none has been supplied. - property of the object. - + property of the object. + > [!NOTE] -> This example includes a password to demonstrate how works with connection strings. In your applications, we recommend that you use Windows Authentication. If you must use a password, do not include a hard-coded password in your application. - +> This example includes a password to demonstrate how works with connection strings. In your applications, we recommend that you use Windows Authentication. If you must use a password, do not include a hard-coded password in your application. + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.IntegratedSecurity/CS/source.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.IntegratedSecurity/VB/source.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.IntegratedSecurity/VB/source.vb" id="Snippet1"::: + ]]> Building Connection Strings @@ -449,34 +440,34 @@ Data Source=OracleDemo;Integrated Security=True;User ID="Mary;NewValue=Bad" Gets or sets the value associated with the specified key. In C#, this property is the indexer. The value associated with the specified key. - contains a fixed-size dictionary, trying to add a key that does not exist within the dictionary throws a . The following table lists all the possible keys within the connection string, and the default value for each. - -|Key|Property|Default value| -|---------|--------------|-------------------| -|Data Source (or server)||Empty string| -|Persist Security Info (or persistsecurityinfo)||False| -|Integrated Security||False| -|User ID (or user or uid)||Empty string| -|Password||Empty string| -|Enlist||True| -|Pooling||True| -|Min Pool Size||0| -|Max Pool Size||100| -|Omit Oracle Connection Name||False| -|Unicode||False| -|Load Balance Timeout (or connection lifetime)||0| - - - -## Examples - The following code, in a console application, creates a new and adds key/value pairs to its connection string, using the property. - + contains a fixed-size dictionary, trying to add a key that does not exist within the dictionary throws a . The following table lists all the possible keys within the connection string, and the default value for each. + +|Key|Property|Default value| +|---------|--------------|-------------------| +|Data Source (or server)||Empty string| +|Persist Security Info (or persistsecurityinfo)||False| +|Integrated Security||False| +|User ID (or user or uid)||Empty string| +|Password||Empty string| +|Enlist||True| +|Pooling||True| +|Min Pool Size||0| +|Max Pool Size||100| +|Omit Oracle Connection Name||False| +|Unicode||False| +|Load Balance Timeout (or connection lifetime)||0| + + + +## Examples + The following code, in a console application, creates a new and adds key/value pairs to its connection string, using the property. + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.Item/CS/source.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.Item/VB/source.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.Item/VB/source.vb" id="Snippet1"::: + ]]> @@ -506,19 +497,19 @@ Data Source=OracleDemo;Integrated Security=True;User ID="Mary;NewValue=Bad" Gets an that contains the keys in the . An that contains the keys in the . - is unspecified, but it is the same order as the associated values in the returned by the property. - - - -## Examples - The following console application example creates a new . The code loops through the returned by the property displaying the key/value pairs. - + is unspecified, but it is the same order as the associated values in the returned by the property. + + + +## Examples + The following console application example creates a new . The code loops through the returned by the property displaying the key/value pairs. + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.Keys/CS/source.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.Keys/VB/source.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.Keys/VB/source.vb" id="Snippet1"::: + ]]> @@ -556,11 +547,11 @@ Data Source=OracleDemo;Integrated Security=True;User ID="Mary;NewValue=Bad" Gets or sets the minimum time, in seconds, for the connection to live in the connection pool before it is removed. The value of the property, or 0 if none has been supplied. - Building Connection Strings @@ -596,11 +587,11 @@ Data Source=OracleDemo;Integrated Security=True;User ID="Mary;NewValue=Bad" Gets or sets the maximum number of connections allowed in the connection pool for this specific connection string. The value of the property, or 100 if none has been supplied. - Building Connection Strings @@ -636,11 +627,11 @@ Data Source=OracleDemo;Integrated Security=True;User ID="Mary;NewValue=Bad" Gets or sets the minimum number of connections allowed in the connection pool for this specific connection string. The value of the property, or 0 if none has been supplied. - Building Connection Strings @@ -677,11 +668,11 @@ Data Source=OracleDemo;Integrated Security=True;User ID="Mary;NewValue=Bad" if transaction rollbacks are enabled; otherwise . - Building Connection Strings @@ -721,16 +712,16 @@ Data Source=OracleDemo;Integrated Security=True;User ID="Mary;NewValue=Bad" Gets or sets the password for the Oracle account. The value of the property, or if none has been supplied. - property is reset. If the value has not been set and the developer tries to retrieve the property, the return value is . - + property is reset. If the value has not been set and the developer tries to retrieve the property, the return value is . + ]]> Building Connection Strings @@ -766,11 +757,11 @@ Data Source=OracleDemo;Integrated Security=True;User ID="Mary;NewValue=Bad" Gets or sets a Boolean value that indicates if security-sensitive information, such as the password, is not returned as part of the connection if the connection is open or has ever been in an open state. The value of the property, or if none has been supplied. - Building Connection Strings @@ -806,11 +797,11 @@ Data Source=OracleDemo;Integrated Security=True;User ID="Mary;NewValue=Bad" Gets or sets a Boolean value that indicates whether the connection will be pooled, or whether each connection will be explicitly opened every time that the connection is requested. The value of the property, or if none has been supplied. - Building Connection Strings @@ -841,41 +832,41 @@ Data Source=OracleDemo;Integrated Security=True;User ID="Mary;NewValue=Bad" if the key existed within the connection string and was removed, if the key did not exist. - method returns a value that indicates its success, it is not necessary to look for the existence of a key before trying to remove the key/value pair from the instance. Because the maintains a fixed-size collection of key/value pairs, calling the method just resets the value of the key/value pair back to its default value. - - Because the collection of keys supported by the is fixed, every item within the collection has a known default value. - - The following table lists the keys, and the value for each when the is first initialized, or after the method has been called: - -|Key|Default value| -|---------|-------------------| -|Data Source|Empty string| -|Persist Security Info|False| -|Integrated Security|False| -|User ID|Empty string| -|Password|Empty string| -|Enlist|True| -|Pooling|True| -|Min Pool Size|0| -|Max Pool Size|100| -|Unicode|False| -|Load Balance Timeout|0| -|Omit Oracle Connection Name|False| - - - -## Examples - The following example converts an existing connection string from using Windows Authentication to using integrated security. The example works by removing the user name and password from the connection string, and then setting the property of the object. - + method returns a value that indicates its success, it is not necessary to look for the existence of a key before trying to remove the key/value pair from the instance. Because the maintains a fixed-size collection of key/value pairs, calling the method just resets the value of the key/value pair back to its default value. + + Because the collection of keys supported by the is fixed, every item within the collection has a known default value. + + The following table lists the keys, and the value for each when the is first initialized, or after the method has been called: + +|Key|Default value| +|---------|-------------------| +|Data Source|Empty string| +|Persist Security Info|False| +|Integrated Security|False| +|User ID|Empty string| +|Password|Empty string| +|Enlist|True| +|Pooling|True| +|Min Pool Size|0| +|Max Pool Size|100| +|Unicode|False| +|Load Balance Timeout|0| +|Omit Oracle Connection Name|False| + + + +## Examples + The following example converts an existing connection string from using Windows Authentication to using integrated security. The example works by removing the user name and password from the connection string, and then setting the property of the object. + > [!NOTE] -> This example includes a password to demonstrate how works with connection strings. In your applications, we recommend that you use Windows Authentication. If you must use a password, do not include a hard-coded password in your application. - +> This example includes a password to demonstrate how works with connection strings. In your applications, we recommend that you use Windows Authentication. If you must use a password, do not include a hard-coded password in your application. + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.Remove/CS/source.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.Remove/VB/source.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.Remove/VB/source.vb" id="Snippet1"::: + ]]> @@ -908,11 +899,11 @@ Data Source=OracleDemo;Integrated Security=True;User ID="Mary;NewValue=Bad" if the contains an entry with the specified key; otherwise, . - method. - + method. + ]]> Building Connection Strings @@ -945,19 +936,19 @@ Data Source=OracleDemo;Integrated Security=True;User ID="Mary;NewValue=Bad" if was found within the connection string; otherwise, . - method lets developers safely retrieve a value from an without needing to verify that the supplied key name is a valid key name. Because gracefully handles searching for a non-existent key, there is no need to look for the existence of a key before retrieving its value. Calling with a nonexistent key will place the value null (`Nothing` in Visual Basic) in the `value` parameter. - - - -## Examples - The following example demonstrates the behavior of the method. - + method lets developers safely retrieve a value from an without needing to verify that the supplied key name is a valid key name. Because gracefully handles searching for a non-existent key, there is no need to look for the existence of a key before retrieving its value. Calling with a nonexistent key will place the value null (`Nothing` in Visual Basic) in the `value` parameter. + + + +## Examples + The following example demonstrates the behavior of the method. + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.TryGetValue/CS/source.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.TryGetValue/VB/source.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.TryGetValue/VB/source.vb" id="Snippet1"::: + ]]> Building Connection Strings @@ -993,11 +984,11 @@ Data Source=OracleDemo;Integrated Security=True;User ID="Mary;NewValue=Bad" Gets or sets a Boolean value that indicates if the client supports the Unicode functionality available in later Oracle clients, or if it is non-Unicode aware. The value of the property, or if none has been supplied. - Building Connection Strings @@ -1033,13 +1024,13 @@ Data Source=OracleDemo;Integrated Security=True;User ID="Mary;NewValue=Bad" Gets or sets the user ID to be used when connecting to Oracle. The value of the property, or if none has been supplied. - property is reset. If the value has not been set and the developer tries to retrieve the property, the return value is . - + property is reset. If the value has not been set and the developer tries to retrieve the property, the return value is . + ]]> Building Connection Strings @@ -1065,19 +1056,19 @@ Data Source=OracleDemo;Integrated Security=True;User ID="Mary;NewValue=Bad" Gets an that contains the values in the . An that contains the values in the . - is unspecified, but it is the same order as the associated keys in the returned by the property. Because each instance of the always contains the same fixed set of keys, the property always returns the values corresponding to the fixed set of keys, in the same order as the keys. - - - -## Examples - The following example first creates a new , and then iterates through all the values within the object. - + is unspecified, but it is the same order as the associated keys in the returned by the property. Because each instance of the always contains the same fixed set of keys, the property always returns the values corresponding to the fixed set of keys, in the same order as the keys. + + + +## Examples + The following example first creates a new , and then iterates through all the values within the object. + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.Values/CS/source.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.Values/VB/source.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.Values/VB/source.vb" id="Snippet1"::: + ]]> Building Connection Strings diff --git a/xml/System.Data.SqlClient/SqlCredential.xml b/xml/System.Data.SqlClient/SqlCredential.xml index d9e398ab48c..09da7544ec6 100644 --- a/xml/System.Data.SqlClient/SqlCredential.xml +++ b/xml/System.Data.SqlClient/SqlCredential.xml @@ -26,57 +26,18 @@ - provides a more secure way to specify the password for a login attempt using SQL Server Authentication. - - is comprised of a user id and a password that will be used for SQL Server Authentication. The password in a object is of type . - - cannot be inherited. - + provides a more secure way to specify the password for a login attempt using SQL Server Authentication. + + is comprised of a user id and a password that will be used for SQL Server Authentication. The password in a object is of type . + + cannot be inherited. + Windows Authentication () remains the most secure way to log in to a SQL Server database. - to get or set a connection's object. Use to change the password for a user via an object. For information on how a object affects connection pool behavior, see [SQL Server Connection Pooling (ADO.NET)](/dotnet/framework/data/adonet/sql-server-connection-pooling). - - An exception will be raised if a non-null object is used in a connection with any of the following connection string keywords: - -- `Integrated Security = true` - -- `Password` - -- `User ID` - -- `Context Connection = true` - - The following sample connects to a SQL Server database using : - -``` -// change connection string in the APP.CONFIG file - -  - - -// then use the following snippet: -using System.Configuration; - -System.Windows.Controls.TextBox txtUserId = new System.Windows.Controls.TextBox(); -System.Windows.Controls.PasswordBox txtPwd = new System.Windows.Controls.PasswordBox(); - -Configuration config = Configuration.WebConfigurationManager.OpenWebConfiguration(Null); -ConnectionStringSettings connString = config.ConnectionStrings.ConnectionString["MyConnString"]; - -using (SqlConnection conn = new SqlConnection(connString.ConnectionString)) -{ -SecureString pwd = txtPwd.SecurePassword; -pwd.MakeReadOnly(); -SqlCredential cred = new SqlCredential(txtUserId.Text, pwd); -conn.Credential = cred; -conn.Open(); -``` - + ADO.NET Overview @@ -112,11 +73,11 @@ conn.Open(); The password; a value marked as read-only. Passing a read/write parameter will raise an . Creates an object of type . - value is allowed. An attempt to pass a null parameter in the constructor will raise an exception. - + value is allowed. An attempt to pass a null parameter in the constructor will raise an exception. + ]]> ADO.NET Overview diff --git a/xml/System.Web.Caching/SqlCacheDependency.xml b/xml/System.Web.Caching/SqlCacheDependency.xml index e1ce0122af7..fd1a1dcfeaa 100644 --- a/xml/System.Web.Caching/SqlCacheDependency.xml +++ b/xml/System.Web.Caching/SqlCacheDependency.xml @@ -33,7 +33,7 @@ The following example shows an ASP.NET Web.config file that enables table-based dependencies on a SQL Server database table. -``` +```xml @@ -53,8 +53,6 @@ ``` - - ## Examples The following code example uses the and controls to display a database table. When the page is loaded, the page attempts to create a object. After the object is created, the page adds an item to the `Cache` with a dependency on the object. You should use exception handling similar to that shown here. diff --git a/xml/System.Web.UI.WebControls/Parameter.xml b/xml/System.Web.UI.WebControls/Parameter.xml index 49ceef82742..4f194d85973 100644 --- a/xml/System.Web.UI.WebControls/Parameter.xml +++ b/xml/System.Web.UI.WebControls/Parameter.xml @@ -30,54 +30,54 @@ Provides a mechanism that data source controls use to bind to application variables, user identities and choices, and other data. Serves as the base class for all ASP.NET parameter types. - class represents a parameter in a parameterized SQL query, a filtering expression, or a business object method call that an ASP.NET data source control uses to select, filter, or modify data. objects are contained in a object. objects are evaluated at run time, to bind the values of the variables they represent to whatever method is used by a data source control to interact with data. - - Use classes that derive from with data source and data-bound controls to build Web-based data applications. These parameter classes are used by data source controls to bind specific kinds of values found in Web applications to placeholders in SQL query strings, business object method parameters, and more. The following table lists parameter types that are included in ASP.NET. - -||| -|-|-| -||Binds any public property of a Web server control.| -||Binds a form field.| -||Binds a session-state field.| -||Binds a route URL parameter.| -||Binds a cookie field.| -||Binds a query-string parameter.| -||Binds a profile field.| - - Extend the base class when you want to implement your own custom parameter types. - - objects are very simple: they have a and a property, can be represented declaratively, and can track state across multiple HTTP requests. All parameters support a property, for cases when a parameter is bound to a value, but the value evaluates to `null` at run time. - - When using a collection of objects with a data source control, their order in the collection might matter. For more information on how parameters are used, see [Using Parameters with the SqlDataSource Control](https://learn.microsoft.com/previous-versions/aspnet/z72eefad(v=vs.100)) and [Using Parameters with the ObjectDataSource Control](https://msdn.microsoft.com/library/45fb67ee-9be7-49b7-9421-e242203dafa4). - - - -## Examples - The following example shows how to use the selected value of a control in the W`here` clause of a SQL query. The example uses the class, which derives from the class. - - The element defines the query with a parameter named "@Title" where the value from `DropDownList1` should go. The element specifies that the "@Title" placeholder will be replaced by the value of the property of the `DropDownList1` control. The element is added to the collection of the control. - + class represents a parameter in a parameterized SQL query, a filtering expression, or a business object method call that an ASP.NET data source control uses to select, filter, or modify data. objects are contained in a object. objects are evaluated at run time, to bind the values of the variables they represent to whatever method is used by a data source control to interact with data. + + Use classes that derive from with data source and data-bound controls to build Web-based data applications. These parameter classes are used by data source controls to bind specific kinds of values found in Web applications to placeholders in SQL query strings, business object method parameters, and more. The following table lists parameter types that are included in ASP.NET. + +||| +|-|-| +||Binds any public property of a Web server control.| +||Binds a form field.| +||Binds a session-state field.| +||Binds a route URL parameter.| +||Binds a cookie field.| +||Binds a query-string parameter.| +||Binds a profile field.| + + Extend the base class when you want to implement your own custom parameter types. + + objects are very simple: they have a and a property, can be represented declaratively, and can track state across multiple HTTP requests. All parameters support a property, for cases when a parameter is bound to a value, but the value evaluates to `null` at run time. + + When using a collection of objects with a data source control, their order in the collection might matter. For more information on how parameters are used, see [Using Parameters with the SqlDataSource Control](https://learn.microsoft.com/previous-versions/aspnet/z72eefad(v=vs.100)) and [Using Parameters with the ObjectDataSource Control](https://msdn.microsoft.com/library/45fb67ee-9be7-49b7-9421-e242203dafa4). + + + +## Examples + The following example shows how to use the selected value of a control in the W`here` clause of a SQL query. The example uses the class, which derives from the class. + + The element defines the query with a parameter named "@Title" where the value from `DropDownList1` should go. The element specifies that the "@Title" placeholder will be replaced by the value of the property of the `DropDownList1` control. The element is added to the collection of the control. + :::code language="aspx-csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSource_2sql/CS/sql2cs.aspx" id="Snippet1"::: - :::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSource_2sql/VB/sql2vb.aspx" id="Snippet1"::: - - The following example is like the previous one, but uses code instead of markup. When the page loads the first time, the control has no selected value, and the property of the object is used. - + :::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSource_2sql/VB/sql2vb.aspx" id="Snippet1"::: + + The following example is like the previous one, but uses code instead of markup. When the page loads the first time, the control has no selected value, and the property of the object is used. + :::code language="aspx-csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter_3/CS/param1acs.aspx" id="Snippet1"::: - :::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter_3/VB/param1avb.aspx" id="Snippet1"::: - - The following code shows the code-behind class for the page in the previous example. - + :::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter_3/VB/param1avb.aspx" id="Snippet1"::: + + The following code shows the code-behind class for the page in the previous example. + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter_3/CS/param1acs.aspx.cs" id="Snippet4"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter_3/VB/param1avb.aspx.vb" id="Snippet4"::: - - The following code example demonstrates how to extend the class to create a new parameter type that can be used by data source controls and other controls in data-binding scenarios. A data source control can use a `StaticParameter` parameter to bind to the value of any object, typically a string, declared on a Web Forms page. - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter_3/VB/param1avb.aspx.vb" id="Snippet4"::: + + The following code example demonstrates how to extend the class to create a new parameter type that can be used by data source controls and other controls in data-binding scenarios. A data source control can use a `StaticParameter` parameter to bind to the value of any object, typically a string, declared on a Web Forms page. + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter_2/CS/staticparameter.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter_2/VB/staticparameter.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter_2/VB/staticparameter.vb" id="Snippet1"::: + ]]> @@ -123,11 +123,11 @@ Initializes a new default instance of the class. - object created with the constructor is initialized with default values for all its properties. The property is initialized to , the property is initialized to , the property is initialized to , and the property is initialized to `null`. - + object created with the constructor is initialized with default values for all its properties. The property is initialized to , the property is initialized to , the property is initialized to , and the property is initialized to `null`. + ]]> @@ -152,19 +152,19 @@ The name of the parameter. Initializes a new instance of the class, using the specified name. - object created with the constructor is initialized with the specified `name` and default values for its other properties. The property is initialized to , the property is initialized to , and the property is initialized to `null`. - - - -## Examples - The following code example demonstrates how to call the constructor from a class that extends the class to initialize the property of the instance. This code example is part of a larger example provided for the class overview. - + object created with the constructor is initialized with the specified `name` and default values for its other properties. The property is initialized to , the property is initialized to , and the property is initialized to `null`. + + + +## Examples + The following code example demonstrates how to call the constructor from a class that extends the class to initialize the property of the instance. This code example is part of a larger example provided for the class overview. + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter_2/CS/staticparameter.cs" id="Snippet2"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter_2/VB/staticparameter.vb" id="Snippet2"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter_2/VB/staticparameter.vb" id="Snippet2"::: + ]]> @@ -190,19 +190,19 @@ A instance from which the current instance is initialized. Initializes a new instance of the class with the values of the original, specified instance. - constructor is a `protected` copy constructor used to clone a instance. The values of the , , , , and properties are all transferred to the new instance. - - - -## Examples - The following code example demonstrates how to call the constructor from a class that extends the class to implement correct object cloning behavior for the class. This code example is part of a larger example provided for the class overview. - + constructor is a `protected` copy constructor used to clone a instance. The values of the , , , , and properties are all transferred to the new instance. + + + +## Examples + The following code example demonstrates how to call the constructor from a class that extends the class to implement correct object cloning behavior for the class. This code example is part of a larger example provided for the class overview. + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter_2/CS/staticparameter.cs" id="Snippet4"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter_2/VB/staticparameter.vb" id="Snippet4"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter_2/VB/staticparameter.vb" id="Snippet4"::: + ]]> @@ -230,11 +230,11 @@ The database type of the parameter. Initializes a new instance of the class, using the specified name and database type. - object created with the constructor is initialized with the specified `name` and `dbType` parameters, and with default values for other properties. The property is initialized to , and the property is initialized to `null`. - + object created with the constructor is initialized with the specified `name` and `dbType` parameters, and with default values for other properties. The property is initialized to , and the property is initialized to `null`. + ]]> @@ -261,19 +261,19 @@ A that describes the type of the parameter. Initializes a new instance of the class, using the specified name and type. - object created with the constructor is initialized with the specified `name` and `type` parameters, and default values for other properties. The property is initialized to , and the property is initialized to `null`. - - - -## Examples - The following code example demonstrates how to call the constructor from a class that extends the class to initialize the and properties of the instance. This code example is part of a larger example provided for the class overview. - + object created with the constructor is initialized with the specified `name` and `type` parameters, and default values for other properties. The property is initialized to , and the property is initialized to `null`. + + + +## Examples + The following code example demonstrates how to call the constructor from a class that extends the class to initialize the and properties of the instance. This code example is part of a larger example provided for the class overview. + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter_2/CS/staticparameter.cs" id="Snippet3"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter_2/VB/staticparameter.vb" id="Snippet3"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter_2/VB/staticparameter.vb" id="Snippet3"::: + ]]> @@ -304,11 +304,11 @@ The default value for the instance, if the is bound to a value that is not yet initialized when is called. Initializes a new instance of the class, using the specified name, the specified database type, and the specified value for its property. - property of the instance is initialized to . - + property of the instance is initialized to . + ]]> @@ -337,19 +337,11 @@ A string that serves as a default value for the parameter, if the is bound to a value that is not yet initialized when is called. Initializes a new instance of the class, using the specified name, the specified type, and the specified string for its property. - object created with the constructor is initialized with the specified `name` parameter and `type` parameter, and assigned a property value. The property is initialized to . - - - -## Examples - The following code example demonstrates how to use the constructor to add update parameter objects to the collection of an control before calling the method. - - :::code language="aspx-csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSource_22sql/CS/sql22cs.aspx" id="Snippet2"::: - :::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSource_22sql/VB/sql22vb.aspx" id="Snippet2"::: - + object created with the constructor is initialized with the specified `name` parameter and `type` parameter, and assigned a property value. The property is initialized to . + ]]> @@ -378,21 +370,21 @@ Returns a duplicate of the current instance. A that is an exact duplicate of the current one. - method calls the copy constructor to initialize a new instance of the class with the values of the current instance. - - If you extend the class, you can override the method to include any state that should be copied to a new instance of your derived class. - - - -## Examples - The following code example demonstrates how to call the constructor from a class that extends the class to implement correct object cloning behavior for the class. This code example is part of a larger example provided for the class. - + method calls the copy constructor to initialize a new instance of the class with the values of the current instance. + + If you extend the class, you can override the method to include any state that should be copied to a new instance of your derived class. + + + +## Examples + The following code example demonstrates how to call the constructor from a class that extends the class to implement correct object cloning behavior for the class. This code example is part of a larger example provided for the class. + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter_2/CS/staticparameter.cs" id="Snippet4"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter_2/VB/staticparameter.vb" id="Snippet4"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter_2/VB/staticparameter.vb" id="Snippet4"::: + ]]> @@ -422,11 +414,11 @@ Converts a value to an equivalent value. A value that is equivalent to the specified value. - instance if no equivalent for the value is found. Database types without equivalent types include , , and . - + instance if no equivalent for the value is found. Database types without equivalent types include , , and . + ]]> @@ -458,11 +450,11 @@ if the value that the is bound to should be converted to when it is ; otherwise, . The default value is . - property of the parameter is changed, the method is called. - + property of the parameter is changed, the method is called. + ]]> @@ -491,11 +483,11 @@ Converts a value to an equivalent value. A value that is equivalent to the specified value. - instance if no equivalent is found. Types without equivalent database types include and . - + instance if no equivalent is found. Types without equivalent database types include and . + ]]> @@ -526,13 +518,13 @@ Gets or sets the database type of the parameter. The database type of the instance. The default value is . - property, the method is called. - + property, the method is called. + ]]> An attempt was made to set this property to a value that is not in the enumeration. @@ -564,23 +556,23 @@ Specifies a default value for the parameter, should the value that the parameter is bound to be uninitialized when the method is called. A string that serves as a default value for the when the value it is bound to cannot be resolved or is uninitialized. - property is used in scenarios where the parameter is bound to a value, but the value is `null` or cannot be resolved when the object is evaluated. - - If the property of the parameter is changed, the method is called. - - - -## Examples - The following code example demonstrates how to retrieve a single data record using an control and display it in a control. The control retrieves a specific employee record by calling the `GetEmployee` method of the `EmployeeLogic` class. The `GetEmployee` method requires an employee ID parameter. The control uses a object in its collection to pass an ID to the `GetEmployee` method in this example. - - To view the example implementation of the `EmployeeLogic` class and the `GetEmployee` method, see the class overview. - + property is used in scenarios where the parameter is bound to a value, but the value is `null` or cannot be resolved when the object is evaluated. + + If the property of the parameter is changed, the method is called. + + + +## Examples + The following code example demonstrates how to retrieve a single data record using an control and display it in a control. The control retrieves a specific employee record by calling the `GetEmployee` method of the `EmployeeLogic` class. The `GetEmployee` method requires an employee ID parameter. The control uses a object in its collection to pass an ID to the `GetEmployee` method in this example. + + To view the example implementation of the `EmployeeLogic` class and the `GetEmployee` method, see the class overview. + :::code language="aspx-csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_3/CS/objds3cs.aspx" id="Snippet1"::: - :::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_3/VB/objds3vb.aspx" id="Snippet1"::: - + :::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_3/VB/objds3vb.aspx" id="Snippet1"::: + ]]> @@ -611,23 +603,23 @@ Indicates whether the object is used to bind a value to a control, or the control can be used to change the value. One of the values. is set to by default. - property is currently not used by the class and is reserved for future use. - - The property describes the direction of the flow of data between the value that a instance is bound to and the object itself. The default value for the property, , describes the most common scenario where the flow of data is always in one direction: from the value to which the object is bound to the object. Any changes made to the underlying value are reflected by the object, but any changes to the object are not reflected by the underlying data. You can set the property to or when working with output parameters, or when working with a return value from a stored procedure. - - If the property of the parameter is changed, the method is called. - - - -## Examples - The following code example demonstrates how to set the , , and properties of objects when using them as output parameters and return value parameters with a stored procedure. This code example is part of a larger example provided for the class overview. - + property is currently not used by the class and is reserved for future use. + + The property describes the direction of the flow of data between the value that a instance is bound to and the object itself. The default value for the property, , describes the most common scenario where the flow of data is always in one direction: from the value to which the object is bound to the object. Any changes made to the underlying value are reflected by the object, but any changes to the object are not reflected by the underlying data. You can set the property to or when working with output parameters, or when working with a return value from a stored procedure. + + If the property of the parameter is changed, the method is called. + + + +## Examples + The following code example demonstrates how to set the , , and properties of objects when using them as output parameters and return value parameters with a stored procedure. This code example is part of a larger example provided for the class overview. + :::code language="aspx-csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSourceStatusEventArgs_1/CS/sql21cs.aspx" id="Snippet2"::: - :::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSourceStatusEventArgs_1/VB/sql21vb.aspx" id="Snippet2"::: - + :::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSourceStatusEventArgs_1/VB/sql21vb.aspx" id="Snippet2"::: + ]]> @@ -662,19 +654,19 @@ Updates and returns the value of the object. An that represents the updated and current value of the parameter. - method is to return `null` in all cases. Classes that derive from the class override the method to return an updated parameter value. For example, the object returns the value of the control that it is bound to, while the object retrieves the current name/value pair from the object. - - - -## Examples - The following code example demonstrates how to override the method to return the correct value in a class that is derived from the class. This code example is part of a larger example provided for the class overview. - + method is to return `null` in all cases. Classes that derive from the class override the method to return an updated parameter value. For example, the object returns the value of the control that it is bound to, while the object retrieves the current name/value pair from the object. + + + +## Examples + The following code example demonstrates how to override the method to return the correct value in a class that is derived from the class. This code example is part of a larger example provided for the class overview. + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter_2/CS/staticparameter.cs" id="Snippet6"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter_2/VB/staticparameter.vb" id="Snippet6"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter_2/VB/staticparameter.vb" id="Snippet6"::: + ]]> @@ -700,11 +692,11 @@ Gets the value that is equivalent to the CLR type of the current instance. The value that is equivalent to the CLR type of the current instance. - property must not already have been set, or must be set to . This method is intended for use only when the CLR type is set but the property is not. - + property must not already have been set, or must be set to . This method is intended for use only when the CLR type is set but the property is not. + ]]> The property is already set to a value other than . @@ -766,13 +758,13 @@ An that represents the state to restore. Restores the data source view's previously saved view state. - object from a previous page request that was saved by the method. - + object from a previous page request that was saved by the method. + ]]> @@ -807,25 +799,25 @@ Gets or sets the name of the parameter. The name of the parameter. The default value is . - objects are not required to have a name; however, data source controls might use the parameter name to match a object in a collection with a parameter in a SQL query or business method signature. For example, the control can use the name of the object to match a placeholder in a parameterized SQL query. Similarly, the control can use the name of a object in the collection to match a placeholder in the property. In some cases, the name is not used and the order in which the object is added to a collection is more important. For more information, see [Using Parameters with the SqlDataSource Control](https://learn.microsoft.com/previous-versions/aspnet/z72eefad(v=vs.100)) and [Using Parameters with the ObjectDataSource Control](https://msdn.microsoft.com/library/45fb67ee-9be7-49b7-9421-e242203dafa4). - - If the name of the parameter is changed, the method is called. - - - -## Examples - The following code example demonstrates how to display filtered data using an control to retrieve data from a middle-tier business object and a control to display the results. The code example consists of a control, a control, the control, and a Submit button. By default, the control is populated with the name of one of the `Northwind` employees. The control displays information about the employee identified by the name in the control. To retrieve data on another employee, enter the full name of the employee in the control and click the button. - - The property specifies an expression used to filter the data retrieved by the property. It uses parameter placeholders that are evaluated to the parameters contained in the collection. In this example, the parameter placeholder is bounded by single quotation marks because the type of the parameter is a string type that might contain spaces. If the type of the parameter is a numeric or date type, bounding quotation marks are not needed. - - This code example is part of a larger example provided for the property of the class. - + objects are not required to have a name; however, data source controls might use the parameter name to match a object in a collection with a parameter in a SQL query or business method signature. For example, the control can use the name of the object to match a placeholder in a parameterized SQL query. Similarly, the control can use the name of a object in the collection to match a placeholder in the property. In some cases, the name is not used and the order in which the object is added to a collection is more important. For more information, see [Using Parameters with the SqlDataSource Control](https://learn.microsoft.com/previous-versions/aspnet/z72eefad(v=vs.100)) and [Using Parameters with the ObjectDataSource Control](https://msdn.microsoft.com/library/45fb67ee-9be7-49b7-9421-e242203dafa4). + + If the name of the parameter is changed, the method is called. + + + +## Examples + The following code example demonstrates how to display filtered data using an control to retrieve data from a middle-tier business object and a control to display the results. The code example consists of a control, a control, the control, and a Submit button. By default, the control is populated with the name of one of the `Northwind` employees. The control displays information about the employee identified by the name in the control. To retrieve data on another employee, enter the full name of the employee in the control and click the button. + + The property specifies an expression used to filter the data retrieved by the property. It uses parameter placeholders that are evaluated to the parameters contained in the collection. In this example, the parameter placeholder is bounded by single quotation marks because the type of the parameter is a string type that might contain spaces. If the type of the parameter is a numeric or date type, bounding quotation marks are not needed. + + This code example is part of a larger example provided for the property of the class. + :::code language="aspx-csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_9/CS/objds9cs.aspx" id="Snippet1"::: - :::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_9/VB/objds9vb.aspx" id="Snippet1"::: - + :::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_9/VB/objds9vb.aspx" id="Snippet1"::: + ]]> @@ -851,25 +843,25 @@ Calls the method of the collection that contains the object. - object is not contained by a collection, calling the method has no effect. If the object is contained by a collection, raises the event of the collection. - - If the collection is contained by a data source control, the event raises the data source control's event, causing any data-bound controls to rebind. - - Raising an event invokes the event handler through a delegate. For more information, see [Handling and Raising Events](/dotnet/standard/events/). - - The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class. - - - -## Examples - The following code example demonstrates how to call the method to raise the event when the state of a parameter changes. This code example is part of a larger example provided for the class overview. - + object is not contained by a collection, calling the method has no effect. If the object is contained by a collection, raises the event of the collection. + + If the collection is contained by a data source control, the event raises the data source control's event, causing any data-bound controls to rebind. + + Raising an event invokes the event handler through a delegate. For more information, see [Handling and Raising Events](/dotnet/standard/events/). + + The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class. + + + +## Examples + The following code example demonstrates how to call the method to raise the event when the state of a parameter changes. This code example is part of a larger example provided for the class overview. + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter_2/CS/staticparameter.cs" id="Snippet7"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter_2/VB/staticparameter.vb" id="Snippet7"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter_2/VB/staticparameter.vb" id="Snippet7"::: + ]]> @@ -899,15 +891,15 @@ Saves the changes to the object's view state since the time the page was posted back to the server. The that contains the changes to the view state. If there is no view state associated with the object, this method returns . - property, which is an instance of the class. This property's value is then persisted to a string object after the save state stage of the server control life cycle. - - When view state is saved, this string object is returned to the client as a variable that is stored in an HTML `hidden` element. When you author custom server controls, you can improve efficiency by overriding this method and modifying your server control's property. - + property, which is an instance of the class. This property's value is then persisted to a string object after the save state stage of the server control life cycle. + + When view state is saved, this string object is returned to the client as a variable that is stored in an HTML `hidden` element. When you author custom server controls, you can improve efficiency by overriding this method and modifying your server control's property. + ]]> @@ -936,11 +928,11 @@ Marks the object so its state will be recorded in view state. - method is called directly by the method, to mark the object so that its state is recorded in view state. - + method is called directly by the method, to mark the object so that its state is recorded in view state. + ]]> @@ -972,11 +964,11 @@ Gets or sets the size of the parameter. The size of the parameter expressed as an integer. - is changed, the method is called. - + is changed, the method is called. + ]]> @@ -1012,13 +1004,13 @@ Returns a duplicate of the current instance. A that is a copy of the current object. - method calls the constructor to initialize a new instance of the class with the values of the current instance. - - If you extend the class, you can override the method to include any state that should be copied to a new instance of your derived class. - + method calls the constructor to initialize a new instance of the class with the values of the current instance. + + If you extend the class, you can override the method to include any state that should be copied to a new instance of your derived class. + ]]> @@ -1100,13 +1092,13 @@ This member is an explicit interface member implementation. It can be used only An that represents the state to restore. Restores the data source view's previously saved view state. - object from a previous page request that was saved by the method. - - This method is used primarily by control developers. You can override this method to control how a custom server control restores its view state. - + object from a previous page request that was saved by the method. + + This method is used primarily by control developers. You can override this method to control how a custom server control restores its view state. + ]]> @@ -1145,15 +1137,15 @@ This member is an explicit interface member implementation. It can be used only Saves the changes to the object's view state since the time the page was posted back to the server. The that contains the changes to the object's view state. If there is no view state associated with the object, this method returns . - property, which is an instance of the class. This property's value is then persisted to a string object after the save state stage of the server control life cycle. - - When view state is saved, this string object is returned to the client as a variable that is stored in an HTML `hidden` element. When you author custom server controls, you can improve efficiency by overriding this method and modifying your server control's property. - + property, which is an instance of the class. This property's value is then persisted to a string object after the save state stage of the server control life cycle. + + When view state is saved, this string object is returned to the client as a variable that is stored in an HTML `hidden` element. When you author custom server controls, you can improve efficiency by overriding this method and modifying your server control's property. + ]]> @@ -1228,19 +1220,19 @@ This member is an explicit interface member implementation. It can be used only Converts the value of this instance to its equivalent string representation. A string representation of the value of this instance. - method returns the property of the object. If the object has no name, returns . - - - -## Examples - The following code example demonstrates how to access various properties of a object, including its and properties. - + method returns the property of the object. If the object has no name, returns . + + + +## Examples + The following code example demonstrates how to access various properties of a object, including its and properties. + :::code language="aspx-csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter.ToString_1/CS/parametertostringcs.aspx" id="Snippet1"::: - :::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter.ToString_1/VB/parametertostringvb.aspx" id="Snippet1"::: - + :::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter.ToString_1/VB/parametertostringvb.aspx" id="Snippet1"::: + ]]> @@ -1296,21 +1288,21 @@ This member is an explicit interface member implementation. It can be used only Gets or sets the type of the parameter. The type of the . The default value is . - method is called. - - - -## Examples - The following code example demonstrates how to set the , , and properties of objects when using them as output parameters and return value parameters with a stored procedure. This code example is part of a larger example provided for the class overview. - + method is called. + + + +## Examples + The following code example demonstrates how to set the , , and properties of objects when using them as output parameters and return value parameters with a stored procedure. This code example is part of a larger example provided for the class overview. + :::code language="aspx-csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSourceStatusEventArgs_1/CS/sql21cs.aspx" id="Snippet2"::: - :::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSourceStatusEventArgs_1/VB/sql21vb.aspx" id="Snippet2"::: - + :::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSourceStatusEventArgs_1/VB/sql21vb.aspx" id="Snippet2"::: + ]]> The parameter type is not one of the values. @@ -1349,21 +1341,21 @@ This member is an explicit interface member implementation. It can be used only Gets a dictionary of state information that allows you to save and restore the view state of a object across multiple requests for the same page. An instance of that contains the object's view-state information. - class, to store the property values. The values are then passed as a variable to an HTML `hidden` input element when subsequent requests are processed. View state is enabled for all server controls by default. - - For more information about dictionaries and how to use them, see [Collections and Data Structures](/dotnet/standard/collections/). - - - -## Examples - The following code example demonstrates how to use the view-state object to store parameter object state in a class that extends the class. This code example is part of a larger example provided for the class overview. - + class, to store the property values. The values are then passed as a variable to an HTML `hidden` input element when subsequent requests are processed. View state is enabled for all server controls by default. + + For more information about dictionaries and how to use them, see [Collections and Data Structures](/dotnet/standard/collections/). + + + +## Examples + The following code example demonstrates how to use the view-state object to store parameter object state in a class that extends the class. This code example is part of a larger example provided for the class overview. + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter_2/CS/staticparameter.cs" id="Snippet5"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter_2/VB/staticparameter.vb" id="Snippet5"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.Parameter_2/VB/staticparameter.vb" id="Snippet5"::: + ]]> diff --git a/xml/System.Web.UI.WebControls/QueryStringParameter.xml b/xml/System.Web.UI.WebControls/QueryStringParameter.xml index b4f38c434b1..bd6eceb90c8 100644 --- a/xml/System.Web.UI.WebControls/QueryStringParameter.xml +++ b/xml/System.Web.UI.WebControls/QueryStringParameter.xml @@ -23,31 +23,24 @@ Binds the value of an HTTP request query-string field to a parameter object. - class to bind the value of a field that is passed as part of an HTTP request query string to a parameter that is used in a parameterized query or command. The field is retrieved from the collection. - - Controls that bind data to the parameter might throw an exception if a object is referenced, but no corresponding query-string name/value pair is passed. Similarly, they might display no data if the query-string field name is passed without a corresponding value. To avoid these situations, set the property where appropriate. - - The class provides the property, which identifies the name of the query string value to bind to. It also provides the properties that are inherited from the class. - + class to bind the value of a field that is passed as part of an HTTP request query string to a parameter that is used in a parameterized query or command. The field is retrieved from the collection. + + Controls that bind data to the parameter might throw an exception if a object is referenced, but no corresponding query-string name/value pair is passed. Similarly, they might display no data if the query-string field name is passed without a corresponding value. To avoid these situations, set the property where appropriate. + + The class provides the property, which identifies the name of the query string value to bind to. It also provides the properties that are inherited from the class. + > [!IMPORTANT] -> The class does not validate the value that is passed; it provides the raw value. However, you can validate the value of a object in a data source control. To do so, handle the `Selecting`, `Updating`, `Inserting`, or `Deleting` event of the data source control and check the parameter value in the event handler. If the value of the parameter does not pass the validation tests, you can cancel the data operation by setting the property of the associated class to `true`. - - - -## Examples - The following example shows how to create a object to use as a filter when you display data in a control. You add the object to the control's collection. The parameter object binds the value of the query-string field named `country` to its string. Because no property is specified for the parameter, if no field named `country` is passed with the query string, the control throws a exception. If a field named `country` is passed but has no value, the control displays no data. - +> The class does not validate the value that is passed; it provides the raw value. However, you can validate the value of a object in a data source control. To do so, handle the `Selecting`, `Updating`, `Inserting`, or `Deleting` event of the data source control and check the parameter value in the event handler. If the value of the parameter does not pass the validation tests, you can cancel the data operation by setting the property of the associated class to `true`. + +## Examples + The following example shows how to create a object to use as a filter when you display data in a control. You add the object to the control's collection. The parameter object binds the value of the query-string field named `country` to its string. Because no property is specified for the parameter, if no field named `country` is passed with the query string, the control throws a exception. If a field named `country` is passed but has no value, the control displays no data. + :::code language="aspx-csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.QueryStringParameter_4/CS/qsp4cs.aspx" id="Snippet1"::: - :::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.QueryStringParameter_4/VB/qsp4vb.aspx" id="Snippet1"::: - - The following example shows how to create a object to display data from an Access database by using a parameterized SQL query. The object retrieves records that are then displayed in a control. The control is also editable, and lets users update the status of orders in the Northwind Traders Orders table. - - :::code language="aspx-csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSource_22sql/CS/sql22cs.aspx" id="Snippet1"::: - :::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSource_22sql/VB/sql22vb.aspx" id="Snippet1"::: - + :::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.QueryStringParameter_4/VB/qsp4vb.aspx" id="Snippet1"::: + ]]> @@ -89,34 +82,34 @@ Initializes a new unnamed instance of the class. - object that is created by using the constructor is initialized with default values for all its properties. The properties are initialized as follows: - -- is initialized to an empty string (""). - -- is initialized to an empty string (""). - -- is initialized to . - -- is initialized to . - -- is initialized to `null`. - - - -## Examples - The following example shows how to use the constructor to create a new parameter and add it to the collection of an control. - + object that is created by using the constructor is initialized with default values for all its properties. The properties are initialized as follows: + +- is initialized to an empty string (""). + +- is initialized to an empty string (""). + +- is initialized to . + +- is initialized to . + +- is initialized to `null`. + + + +## Examples + The following example shows how to use the constructor to create a new parameter and add it to the collection of an control. + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.QueryStringParameter_1/CS/querystrparam1cs.aspx.cs" id="Snippet2"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.QueryStringParameter_1/VB/querystrparam1vb.aspx.vb" id="Snippet2"::: - - The object is added to the control and is declared in an ASP.NET Web page. The control uses the control to bind and display data whenever the page is requested with a query string that contains a field that is named `empId` and that has a corresponding value. - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.QueryStringParameter_1/VB/querystrparam1vb.aspx.vb" id="Snippet2"::: + + The object is added to the control and is declared in an ASP.NET Web page. The control uses the control to bind and display data whenever the page is requested with a query string that contains a field that is named `empId` and that has a corresponding value. + :::code language="aspx-csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.QueryStringParameter_1/CS/querystrparam1cs.aspx" id="Snippet3"::: - :::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.QueryStringParameter_1/VB/querystrparam1vb.aspx" id="Snippet3"::: - + :::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.QueryStringParameter_1/VB/querystrparam1vb.aspx" id="Snippet3"::: + ]]> @@ -141,11 +134,11 @@ A instance from which the current instance is initialized. Initializes a new instance of the class, using the values of the instance that is specified by the parameter. - constructor is a protected copy constructor that is used to clone a instance. The values of the , , and properties are transferred to the new instance. - + constructor is a protected copy constructor that is used to clone a instance. The values of the , , and properties are transferred to the new instance. + ]]> @@ -173,19 +166,19 @@ The name of the query-string field that the parameter object is bound to. The default is an empty string (""). Initializes a new named instance of the class, using the specified string to identify which query-string field to bind to. - object that is created by using the constructor is initialized with the specified parameter name that identifies the query-string field that the parameter binds to. The and properties are initialized with default values. - - - -## Examples - The following example shows how to create two objects by using the constructor and add them to an control's collection. A control displays data if the `employee` and `country` query-string fields are passed with the request and if they have valid values. - + object that is created by using the constructor is initialized with the specified parameter name that identifies the query-string field that the parameter binds to. The and properties are initialized with default values. + + + +## Examples + The following example shows how to create two objects by using the constructor and add them to an control's collection. A control displays data if the `employee` and `country` query-string fields are passed with the request and if they have valid values. + :::code language="aspx-csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.QueryStringParameter_2/CS/qsp2cs.aspx" id="Snippet1"::: - :::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.QueryStringParameter_2/VB/qsp2vb.aspx" id="Snippet1"::: - + :::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.QueryStringParameter_2/VB/qsp2vb.aspx" id="Snippet1"::: + ]]> @@ -242,19 +235,19 @@ The name of the query-string field that the parameter object is bound to. The default is an empty string (""). Initializes a new named and strongly typed instance of the class, using the specified string to identify which query-string field to bind to. - object that is created by using the constructor is initialized with the specified parameter name, the parameter type, and a string that identifies the query-string field that the parameter binds to. The and properties are initialized with default values. - - - -## Examples - The following example shows how to create a object by using the constructor and add it to an control's collection. A control displays data if the `employee` and `country` query-string fields are passed with the request and if they have valid values. - + object that is created by using the constructor is initialized with the specified parameter name, the parameter type, and a string that identifies the query-string field that the parameter binds to. The and properties are initialized with default values. + + + +## Examples + The following example shows how to create a object by using the constructor and add it to an control's collection. A control displays data if the `employee` and `country` query-string fields are passed with the request and if they have valid values. + :::code language="aspx-csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.QueryStringParameter_3/CS/qsp3cs.aspx" id="Snippet1"::: - :::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.QueryStringParameter_3/VB/qsp3vb.aspx" id="Snippet1"::: - + :::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.QueryStringParameter_3/VB/qsp3vb.aspx" id="Snippet1"::: + ]]> @@ -282,11 +275,11 @@ Returns a duplicate of the current instance. A duplicate of the current instance. - method calls the constructor to initialize a new instance of the class by using the values of the current instance. - + method calls the constructor to initialize a new instance of the class by using the values of the current instance. + ]]> @@ -318,19 +311,19 @@ The current instance of the request. - A Web server control that is associated with the ASP.NET Web page where the object is used. - + A Web server control that is associated with the ASP.NET Web page where the object is used. + **Note** This parameter is not used. Updates and returns the value of the object. An object that represents the current value of the parameter. If the context or the request is , the method returns . - object tries to bind to the query-string field every time that the method is called. - - The `context` parameter is used by the method to retrieve the value of the specified query-string field from the query string. The `control` parameter is ignored. - + object tries to bind to the query-string field every time that the method is called. + + The `context` parameter is used by the method to retrieve the value of the specified query-string field from the query string. The `control` parameter is ignored. + ]]> @@ -362,24 +355,24 @@ Gets or sets the name of the query-string field that the parameter binds to. The name of the query-string field that the parameter binds to. - property identifies a name/value pair that is passed with the query string. The property identifies the name of the pair, whereas the property binds to its corresponding value at run time. If the expected query-string name/value pair is not passed to the page with the query string, the method then tries to bind the parameter to the value of the property. If the property is not set, the method fails to bind the parameter to a value. - - - -## Examples - The following example shows how to use a object together with a control to display data in a control. The property is set to the name of the expected query-string field, and the parameter is added to the collection. A property is provided in case the name/value pair is not passed with the query string. - + property identifies a name/value pair that is passed with the query string. The property identifies the name of the pair, whereas the property binds to its corresponding value at run time. If the expected query-string name/value pair is not passed to the page with the query string, the method then tries to bind the parameter to the value of the property. If the property is not set, the method fails to bind the parameter to a value. + + + +## Examples + The following example shows how to use a object together with a control to display data in a control. The property is set to the name of the expected query-string field, and the parameter is added to the collection. A property is provided in case the name/value pair is not passed with the query string. + :::code language="aspx-csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.QueryStringParameter_1/CS/querystrparam1cs.aspx" id="Snippet1"::: - :::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.QueryStringParameter_1/VB/querystrparam1vb.aspx" id="Snippet1"::: - - The following example shows how to use a object together with a control to display data in a control. The object is added to the collection, together with other parameter objects that are used for the output parameter and return value. To retrieve data, handle the values that are returned from the stored procedure. This code example is part of a larger example that is provided for the class. - + :::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.QueryStringParameter_1/VB/querystrparam1vb.aspx" id="Snippet1"::: + + The following example shows how to use a object together with a control to display data in a control. The object is added to the collection, together with other parameter objects that are used for the output parameter and return value. To retrieve data, handle the values that are returned from the stored procedure. This code example is part of a larger example that is provided for the class. + :::code language="aspx-csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSourceStatusEventArgs_1/CS/sql21cs.aspx" id="Snippet2"::: - :::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSourceStatusEventArgs_1/VB/sql21vb.aspx" id="Snippet2"::: - + :::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSourceStatusEventArgs_1/VB/sql21vb.aspx" id="Snippet2"::: + ]]> @@ -410,11 +403,11 @@ if the value of the query parameter is being validated; otherwise, . - is set to `true`, and the property is set to `false`, the query string parameter will not be validated. However, if the page property is set to `true`, and the property is set to `true`, the query string parameter will be validated. If the page property is set to `false`, the query string parameter will be validated regardless of whether the property is set to `true` or `false`. - + is set to `true`, and the property is set to `false`, the query string parameter will not be validated. However, if the page property is set to `true`, and the property is set to `true`, the query string parameter will be validated. If the page property is set to `false`, the query string parameter will be validated regardless of whether the property is set to `true` or `false`. + ]]> diff --git a/xml/System.Web.UI.WebControls/SqlDataSource.xml b/xml/System.Web.UI.WebControls/SqlDataSource.xml index bc28b3884dd..94e478cc838 100644 --- a/xml/System.Web.UI.WebControls/SqlDataSource.xml +++ b/xml/System.Web.UI.WebControls/SqlDataSource.xml @@ -1040,29 +1040,12 @@ This section contains four code examples: > [!IMPORTANT] > For information about storing a connection string, see [How To: Secure Connection Strings when Using Data Source Controls](https://learn.microsoft.com/previous-versions/aspnet/ms178372(v=vs.100)). - - ## Examples - This section contains two code examples. The first code example demonstrates how to set the property to connect to a Microsoft SQL Server database and display the results of the property in a control. The second code example demonstrates a more complex scenario, where a control is used to display and update data in a password-protected Microsoft Access database. In each case, the `connectionStrings` element of the Web.config file is shown first, followed by the ASP.NET page that contains the control. - - The following code example demonstrates how to set the property to connect to a SQL Server database and display the results of the property in a control. - +The following code example demonstrates how to set the property to connect to a SQL Server database and display the results of the property in a control. :::code language="aspx-csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSource_3sql/CS/sql3cs.aspx" id="Snippet1"::: :::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSource_3sql/VB/sql3vb.aspx" id="Snippet1"::: - - The following code example demonstrates a more complex scenario than the preceding code example, where a control is used to display and update data in a password-protected Access database. Because the is used with Access, the property is set to the provider, and the property is set to an appropriate connection string for a UNC-shared Access database. A control displays orders with shipment dates. You can update an order by checking the appropriate check box, and then clicking the **Update** button. - -> [!IMPORTANT] -> This example includes a password in plain text only for illustration purposes. In a production application, connection strings that include passwords should be encrypted. For more information, see [Protecting Connection Information](/dotnet/framework/data/adonet/protecting-connection-information). - - :::code language="aspx-csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSource_22sql/CS/sql22cs.aspx" id="Snippet1"::: - :::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSource_22sql/VB/sql22vb.aspx" id="Snippet1"::: - - :::code language="aspx-csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSource_22sql/CS/sql22cs.aspx" id="Snippet2"::: - :::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSource_22sql/VB/sql22vb.aspx" id="Snippet2"::: - ]]> From 517862c69c01c759c79089db0594434f16ffb40a Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Tue, 1 Oct 2024 14:04:33 -0700 Subject: [PATCH 3/7] ROPC fixes in VB files (#10480) --- .../VB/Project.vbproj | 12 +++ .../Classic WebData OdbcCommand/VB/source.vb | 5 - .../VB/Project.vbproj | 12 +++ .../VB/source.vb | 7 -- .../VB/Project.vbproj | 12 +++ .../VB/source.vb | 11 +-- .../VB/Project.vbproj | 12 +++ .../VB/source.vb | 9 +- .../VB/Project.vbproj | 12 +++ .../VB/source.vb | 10 +- .../VB/Project.vbproj | 12 +++ .../VB/source.vb | 6 -- .../VB/Project.vbproj | 12 +++ .../VB/source.vb | 6 -- .../VB/Project.vbproj | 12 +++ .../VB/source.vb | 6 -- .../VB/Project.vbproj | 12 +++ .../VB/source.vb | 6 -- .../VB/Project.vbproj | 12 +++ .../VB/source.vb | 6 -- .../VB/Project.vbproj | 12 +++ .../VB/source.vb | 6 -- .../VB/Project.vbproj | 12 +++ .../VB/source.vb | 6 -- .../VB/Project.vbproj | 12 +++ .../VB/source.vb | 6 -- .../VB/Project.vbproj | 12 +++ .../VB/source.vb | 5 - .../VB/Project.vbproj | 12 +++ .../VB/source.vb | 6 -- .../Project.vbproj | 12 +++ .../VB/Project.vbproj | 12 +++ .../VB/source.vb | 7 -- .../VB/Project.vbproj | 12 +++ .../VB/source.vb | 5 - .../VB/Project.vbproj | 12 +++ .../VB/source.vb | 4 - .../VB/Project.vbproj | 12 +++ .../VB/source.vb | 6 -- .../VB/Project.vbproj | 12 +++ .../VB/Project.vbproj | 12 +++ .../VB/Project.vbproj | 12 +++ .../VB/Project.vbproj | 12 +++ .../VB/Project.vbproj | 2 +- .../VB/source.vb | 7 -- .../VB/Project.vbproj | 12 +++ .../VB/source.vb | 7 -- .../VB/Project.vbproj | 2 +- .../VB/source.vb | 7 -- .../VB/Project.vbproj | 2 +- .../VB/source.vb | 7 -- .../VB/Project.vbproj | 12 +++ .../VB/source.vb | 5 - .../VB/Project.vbproj | 12 +++ .../VB/source.vb | 6 -- .../VB/Project.vbproj | 12 +++ .../VB/source.vb | 13 +-- .../VB/source.vb | 36 ------- .../VB/Project.vbproj | 8 ++ .../VB/source.vb | 15 ++- .../VB/Project.vbproj | 8 ++ .../VB/source.vb | 30 ++---- .../VB/source.vb | 48 --------- .../VB/Project.vbproj | 12 +++ .../VB/source.vb | 7 +- .../VB/Project.vbproj | 12 +++ .../VB/source.vb | 49 ++++------ .../idatareader_nextresult/vb/Project.vbproj | 14 +++ .../idatareader_nextresult/vb/source.vb | 10 +- .../VB/sql22vb.aspx | 97 ------------------- 70 files changed, 441 insertions(+), 422 deletions(-) create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcCommand/VB/Project.vbproj create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction/VB/Project.vbproj create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction1/VB/Project.vbproj create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.Close/VB/Project.vbproj create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection/VB/Project.vbproj create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.DeleteCommand/VB/Project.vbproj create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.InsertCommand/VB/Project.vbproj create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter/VB/Project.vbproj create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter1/VB/Project.vbproj create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter2/VB/Project.vbproj create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter3/VB/Project.vbproj create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.SelectCommand/VB/Project.vbproj create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.UpdateCommand/VB/Project.vbproj create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter/VB/Project.vbproj create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcParameter/VB/Project.vbproj create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OleDbCommand.ExecuteNonQuery Example/Project.vbproj create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OleDbCommand.Prepare Example/VB/Project.vbproj create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OleDbDataReader.GetOrdinal/VB/Project.vbproj create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OleDbParameter Example/VB/Project.vbproj create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlCommand Example/VB/Project.vbproj create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlCommand.Connection Example/VB/Project.vbproj create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlCommand.ExecuteNonQuery Example/VB/Project.vbproj create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlCommand.ExecuteXmlReader/VB/Project.vbproj create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlCommand.Prepare/VB/Project.vbproj create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction1 Example/VB/Project.vbproj create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Close Example/VB/Project.vbproj create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.GetOrdinal/VB/Project.vbproj create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Read Example/VB/Project.vbproj delete mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.Add/VB/source.vb create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.ConnectionString/VB/Project.vbproj create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder/VB/Project.vbproj delete mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder.Clear/VB/source.vb create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder.Item/VB/Project.vbproj create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.ContainsKey/VB/Project.vbproj create mode 100644 snippets/visualbasic/VS_Snippets_ADO.NET/idatareader_nextresult/vb/Project.vbproj delete mode 100644 snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSource_22sql/VB/sql22vb.aspx diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcCommand/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcCommand/VB/Project.vbproj new file mode 100644 index 00000000000..2026ecb0ada --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcCommand/VB/Project.vbproj @@ -0,0 +1,12 @@ + + + + Library + net4.8 + + + + + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcCommand/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcCommand/VB/source.vb index 08d6e08525b..f234389233b 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcCommand/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcCommand/VB/source.vb @@ -6,11 +6,6 @@ Imports System.Data.Odbc Module Module1 - Sub Main() - 'Dim connectionString As String = _ - '"Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Samples\Northwind.mdb" - End Sub - ' Public Sub InsertRow(ByVal connectionString As String, _ ByVal insertSQL As String) diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction/VB/Project.vbproj new file mode 100644 index 00000000000..2026ecb0ada --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction/VB/Project.vbproj @@ -0,0 +1,12 @@ + + + + Library + net4.8 + + + + + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction/VB/source.vb index 144197cbd47..f479299fa81 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction/VB/source.vb @@ -6,13 +6,6 @@ Imports System.Data.Odbc Module Module1 - Sub Main() - Dim connectionString As String - - connectionString = "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Samples\Northwind.mdb" - Call ExecuteTransaction(connectionString) - End Sub - ' Public Sub ExecuteTransaction(ByVal connectionString As String) diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction1/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction1/VB/Project.vbproj new file mode 100644 index 00000000000..2026ecb0ada --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction1/VB/Project.vbproj @@ -0,0 +1,12 @@ + + + + Library + net4.8 + + + + + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction1/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction1/VB/source.vb index 144197cbd47..824def31958 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction1/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.BeginTransaction1/VB/source.vb @@ -6,13 +6,6 @@ Imports System.Data.Odbc Module Module1 - Sub Main() - Dim connectionString As String - - connectionString = "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Samples\Northwind.mdb" - Call ExecuteTransaction(connectionString) - End Sub - ' Public Sub ExecuteTransaction(ByVal connectionString As String) @@ -35,10 +28,10 @@ Module Module1 command.Transaction = transaction ' Execute the commands. - command.CommandText = _ + command.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (100, 'Description')" command.ExecuteNonQuery() - command.CommandText = _ + command.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (101, 'Description')" command.ExecuteNonQuery() diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.Close/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.Close/VB/Project.vbproj new file mode 100644 index 00000000000..2026ecb0ada --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.Close/VB/Project.vbproj @@ -0,0 +1,12 @@ + + + + Library + net4.8 + + + + + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.Close/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.Close/VB/source.vb index 34d0928a414..78ee6d5f9e5 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.Close/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection.Close/VB/source.vb @@ -2,13 +2,6 @@ Module Module1 - Sub Main() - Dim connectionString As String - - connectionString = "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Samples\Northwind.mdb" - Call CreateOdbcConnection(connectionString) - End Sub - ' Private Sub CreateOdbcConnection(ByVal connectionString As String) Using connection As New OdbcConnection(connectionString) @@ -20,7 +13,7 @@ Module Module1 ' The connection is automatically closed ' at the end of the Using block. - End Using + End Using End Sub ' diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection/VB/Project.vbproj new file mode 100644 index 00000000000..2026ecb0ada --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection/VB/Project.vbproj @@ -0,0 +1,12 @@ + + + + Library + net4.8 + + + + + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection/VB/source.vb index a97befb4d1c..bd92d77f0c0 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcConnection/VB/source.vb @@ -2,12 +2,6 @@ Module Module1 - Sub Main() - Dim connectionString As String - connectionString = "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Samples\Northwind.mdb" - Call InsertRow(connectionString) - End Sub - ' Private Sub InsertRow(ByVal connectionString As String) @@ -20,10 +14,10 @@ Module Module1 connection.Open() command.ExecuteNonQuery() - ' The connection is automatically closed at + ' The connection is automatically closed at ' the end of the Using block. End Using End Sub ' -End Module \ No newline at end of file +End Module diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.DeleteCommand/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.DeleteCommand/VB/Project.vbproj new file mode 100644 index 00000000000..2026ecb0ada --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.DeleteCommand/VB/Project.vbproj @@ -0,0 +1,12 @@ + + + + Library + net4.8 + + + + + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.DeleteCommand/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.DeleteCommand/VB/source.vb index f915f44057d..4066e50adb1 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.DeleteCommand/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.DeleteCommand/VB/source.vb @@ -6,12 +6,6 @@ Imports System.Data.Odbc Module Module1 - Sub Main() - 'Dim connectionString As String = _ - '"Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Samples\Northwind.mdb" - 'dim x as String="DRIVER={SQL Server};SERVER=MyServer;Trusted_connection=yes;DATABASE=Northwind;" - End Sub - ' Public Function CreateDataAdapter( _ ByVal connection As OdbcConnection) As OdbcDataAdapter diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.InsertCommand/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.InsertCommand/VB/Project.vbproj new file mode 100644 index 00000000000..2026ecb0ada --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.InsertCommand/VB/Project.vbproj @@ -0,0 +1,12 @@ + + + + Library + net4.8 + + + + + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.InsertCommand/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.InsertCommand/VB/source.vb index f915f44057d..4066e50adb1 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.InsertCommand/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.InsertCommand/VB/source.vb @@ -6,12 +6,6 @@ Imports System.Data.Odbc Module Module1 - Sub Main() - 'Dim connectionString As String = _ - '"Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Samples\Northwind.mdb" - 'dim x as String="DRIVER={SQL Server};SERVER=MyServer;Trusted_connection=yes;DATABASE=Northwind;" - End Sub - ' Public Function CreateDataAdapter( _ ByVal connection As OdbcConnection) As OdbcDataAdapter diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter/VB/Project.vbproj new file mode 100644 index 00000000000..2026ecb0ada --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter/VB/Project.vbproj @@ -0,0 +1,12 @@ + + + + Library + net4.8 + + + + + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter/VB/source.vb index f915f44057d..4066e50adb1 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter/VB/source.vb @@ -6,12 +6,6 @@ Imports System.Data.Odbc Module Module1 - Sub Main() - 'Dim connectionString As String = _ - '"Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Samples\Northwind.mdb" - 'dim x as String="DRIVER={SQL Server};SERVER=MyServer;Trusted_connection=yes;DATABASE=Northwind;" - End Sub - ' Public Function CreateDataAdapter( _ ByVal connection As OdbcConnection) As OdbcDataAdapter diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter1/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter1/VB/Project.vbproj new file mode 100644 index 00000000000..2026ecb0ada --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter1/VB/Project.vbproj @@ -0,0 +1,12 @@ + + + + Library + net4.8 + + + + + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter1/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter1/VB/source.vb index f915f44057d..4066e50adb1 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter1/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter1/VB/source.vb @@ -6,12 +6,6 @@ Imports System.Data.Odbc Module Module1 - Sub Main() - 'Dim connectionString As String = _ - '"Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Samples\Northwind.mdb" - 'dim x as String="DRIVER={SQL Server};SERVER=MyServer;Trusted_connection=yes;DATABASE=Northwind;" - End Sub - ' Public Function CreateDataAdapter( _ ByVal connection As OdbcConnection) As OdbcDataAdapter diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter2/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter2/VB/Project.vbproj new file mode 100644 index 00000000000..2026ecb0ada --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter2/VB/Project.vbproj @@ -0,0 +1,12 @@ + + + + Library + net4.8 + + + + + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter2/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter2/VB/source.vb index f915f44057d..4066e50adb1 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter2/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter2/VB/source.vb @@ -6,12 +6,6 @@ Imports System.Data.Odbc Module Module1 - Sub Main() - 'Dim connectionString As String = _ - '"Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Samples\Northwind.mdb" - 'dim x as String="DRIVER={SQL Server};SERVER=MyServer;Trusted_connection=yes;DATABASE=Northwind;" - End Sub - ' Public Function CreateDataAdapter( _ ByVal connection As OdbcConnection) As OdbcDataAdapter diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter3/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter3/VB/Project.vbproj new file mode 100644 index 00000000000..2026ecb0ada --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter3/VB/Project.vbproj @@ -0,0 +1,12 @@ + + + + Library + net4.8 + + + + + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter3/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter3/VB/source.vb index f915f44057d..4066e50adb1 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter3/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.OdbcDataAdapter3/VB/source.vb @@ -6,12 +6,6 @@ Imports System.Data.Odbc Module Module1 - Sub Main() - 'Dim connectionString As String = _ - '"Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Samples\Northwind.mdb" - 'dim x as String="DRIVER={SQL Server};SERVER=MyServer;Trusted_connection=yes;DATABASE=Northwind;" - End Sub - ' Public Function CreateDataAdapter( _ ByVal connection As OdbcConnection) As OdbcDataAdapter diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.SelectCommand/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.SelectCommand/VB/Project.vbproj new file mode 100644 index 00000000000..2026ecb0ada --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.SelectCommand/VB/Project.vbproj @@ -0,0 +1,12 @@ + + + + Library + net4.8 + + + + + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.SelectCommand/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.SelectCommand/VB/source.vb index f915f44057d..4066e50adb1 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.SelectCommand/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.SelectCommand/VB/source.vb @@ -6,12 +6,6 @@ Imports System.Data.Odbc Module Module1 - Sub Main() - 'Dim connectionString As String = _ - '"Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Samples\Northwind.mdb" - 'dim x as String="DRIVER={SQL Server};SERVER=MyServer;Trusted_connection=yes;DATABASE=Northwind;" - End Sub - ' Public Function CreateDataAdapter( _ ByVal connection As OdbcConnection) As OdbcDataAdapter diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.UpdateCommand/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.UpdateCommand/VB/Project.vbproj new file mode 100644 index 00000000000..2026ecb0ada --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.UpdateCommand/VB/Project.vbproj @@ -0,0 +1,12 @@ + + + + Library + net4.8 + + + + + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.UpdateCommand/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.UpdateCommand/VB/source.vb index f915f44057d..4066e50adb1 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.UpdateCommand/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter.UpdateCommand/VB/source.vb @@ -6,12 +6,6 @@ Imports System.Data.Odbc Module Module1 - Sub Main() - 'Dim connectionString As String = _ - '"Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Samples\Northwind.mdb" - 'dim x as String="DRIVER={SQL Server};SERVER=MyServer;Trusted_connection=yes;DATABASE=Northwind;" - End Sub - ' Public Function CreateDataAdapter( _ ByVal connection As OdbcConnection) As OdbcDataAdapter diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter/VB/Project.vbproj new file mode 100644 index 00000000000..2026ecb0ada --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter/VB/Project.vbproj @@ -0,0 +1,12 @@ + + + + Library + net4.8 + + + + + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter/VB/source.vb index 4c366399468..77928cc23eb 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcDataAdapter/VB/source.vb @@ -6,11 +6,6 @@ Imports System.Data.Odbc Module Module1 - Sub Main() - 'Dim connectionString As String = _ - '"Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Samples\Northwind.mdb" - End Sub - ' Public Function GetDataSetFromAdapter( _ ByVal dataSet As DataSet, ByVal connectionString As String, _ diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcParameter/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcParameter/VB/Project.vbproj new file mode 100644 index 00000000000..2026ecb0ada --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcParameter/VB/Project.vbproj @@ -0,0 +1,12 @@ + + + + Library + net4.8 + + + + + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcParameter/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcParameter/VB/source.vb index 32e5af7efa6..fbd8b7f1871 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcParameter/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OdbcParameter/VB/source.vb @@ -6,12 +6,6 @@ Imports System.Data.Odbc Module Module1 - Sub Main() - 'Dim connectionString As String = _ - '"Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Samples\Northwind.mdb" - 'dim x as String="DRIVER={SQL Server};SERVER=MyServer;Trusted_connection=yes;DATABASE=Northwind;" - End Sub - ' Public Function GetDataSetFromAdapter( _ ByVal dataSet As DataSet, ByVal connectionString As String, _ diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OleDbCommand.ExecuteNonQuery Example/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OleDbCommand.ExecuteNonQuery Example/Project.vbproj new file mode 100644 index 00000000000..ccdf2c3dbe0 --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OleDbCommand.ExecuteNonQuery Example/Project.vbproj @@ -0,0 +1,12 @@ + + + + Exe + net4.8 + + + + + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OleDbCommand.Prepare Example/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OleDbCommand.Prepare Example/VB/Project.vbproj new file mode 100644 index 00000000000..546c755387d --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OleDbCommand.Prepare Example/VB/Project.vbproj @@ -0,0 +1,12 @@ + + + + Library + net4.8 + + + + + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OleDbCommand.Prepare Example/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OleDbCommand.Prepare Example/VB/source.vb index fff8d1f636c..adf1857a6f4 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OleDbCommand.Prepare Example/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OleDbCommand.Prepare Example/VB/source.vb @@ -5,13 +5,6 @@ Imports System.Data.OleDb Module Module1 - Sub Main() - Dim connectionString As String = "Provider=sqloledb;Data Source=(local);Initial Catalog=Northwind;" _ - & "Integrated Security=SSPI" - OleDbCommandPrepare(connectionString) - Console.ReadLine() - End Sub - ' Public Sub OleDbCommandPrepare(ByVal connectionString As String) diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OleDbDataReader.GetOrdinal/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OleDbDataReader.GetOrdinal/VB/Project.vbproj new file mode 100644 index 00000000000..546c755387d --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OleDbDataReader.GetOrdinal/VB/Project.vbproj @@ -0,0 +1,12 @@ + + + + Library + net4.8 + + + + + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OleDbDataReader.GetOrdinal/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OleDbDataReader.GetOrdinal/VB/source.vb index fe0888cb04e..a01b096afbb 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OleDbDataReader.GetOrdinal/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OleDbDataReader.GetOrdinal/VB/source.vb @@ -7,11 +7,6 @@ Imports System.IO Module Module1 - Sub Main() - Dim x As String = "Provider=SQLOLEDB;Data Source=(local);Integrated Security=SSPI;Initial Catalog=Northwind" - ReadData(x) - End Sub - ' Public Sub ReadData(ByVal connectionString As String) Dim queryString As String = "SELECT DISTINCT CustomerID FROM Orders" diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OleDbParameter Example/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OleDbParameter Example/VB/Project.vbproj new file mode 100644 index 00000000000..546c755387d --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OleDbParameter Example/VB/Project.vbproj @@ -0,0 +1,12 @@ + + + + Library + net4.8 + + + + + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OleDbParameter Example/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OleDbParameter Example/VB/source.vb index d725273c0ba..659f24c69d1 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OleDbParameter Example/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData OleDbParameter Example/VB/source.vb @@ -7,10 +7,6 @@ Imports System.IO Module Module1 - Sub Main() - ' Dim x As String = "Provider=SQLOLEDB;Data Source=(local);Integrated Security=SSPI;Initial Catalog=Northwind" - End Sub - ' Public Function GetDataSetFromAdapter( _ ByVal dataSet As DataSet, ByVal connectionString As String, _ diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlCommand Example/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlCommand Example/VB/Project.vbproj new file mode 100644 index 00000000000..484c85eac09 --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlCommand Example/VB/Project.vbproj @@ -0,0 +1,12 @@ + + + + Library + net4.8 + + + + + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlCommand Example/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlCommand Example/VB/source.vb index 915e6cf365f..f903942d4ab 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlCommand Example/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlCommand Example/VB/source.vb @@ -6,12 +6,6 @@ Imports System.Data.SqlClient Module Module1 - Sub Main() - Dim str As String = "Data Source=(local);Initial Catalog=Northwind;" _ - & "Integrated Security=SSPI;" - ReadOrderData(str) - End Sub - ' Public Sub ReadOrderData(ByVal connectionString As String) Dim queryString As String = _ diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlCommand.Connection Example/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlCommand.Connection Example/VB/Project.vbproj new file mode 100644 index 00000000000..84455e1397c --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlCommand.Connection Example/VB/Project.vbproj @@ -0,0 +1,12 @@ + + + + Exe + net4.8 + + + + + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlCommand.ExecuteNonQuery Example/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlCommand.ExecuteNonQuery Example/VB/Project.vbproj new file mode 100644 index 00000000000..84455e1397c --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlCommand.ExecuteNonQuery Example/VB/Project.vbproj @@ -0,0 +1,12 @@ + + + + Exe + net4.8 + + + + + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlCommand.ExecuteXmlReader/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlCommand.ExecuteXmlReader/VB/Project.vbproj new file mode 100644 index 00000000000..84455e1397c --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlCommand.ExecuteXmlReader/VB/Project.vbproj @@ -0,0 +1,12 @@ + + + + Exe + net4.8 + + + + + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlCommand.Prepare/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlCommand.Prepare/VB/Project.vbproj new file mode 100644 index 00000000000..84455e1397c --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlCommand.Prepare/VB/Project.vbproj @@ -0,0 +1,12 @@ + + + + Exe + net4.8 + + + + + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction Example/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction Example/VB/Project.vbproj index 9de5f49321c..b8fcb56ef9d 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction Example/VB/Project.vbproj +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction Example/VB/Project.vbproj @@ -1,7 +1,7 @@ - Exe + Library net8.0 diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction Example/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction Example/VB/source.vb index 672612b5420..cade2cf5c85 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction Example/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction Example/VB/source.vb @@ -6,13 +6,6 @@ Imports System.Data.SqlClient Module Module1 - Sub Main() - Dim connectionString As String = _ - "Persist Security Info=False;Integrated Security=SSPI;database=Northwind;server=(local)" - ExecuteSqlTransaction(connectionString) - Console.ReadLine() - - End Sub ' Private Sub ExecuteSqlTransaction(ByVal connectionString As String) Using connection As New SqlConnection(connectionString) diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction1 Example/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction1 Example/VB/Project.vbproj new file mode 100644 index 00000000000..484c85eac09 --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction1 Example/VB/Project.vbproj @@ -0,0 +1,12 @@ + + + + Library + net4.8 + + + + + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction1 Example/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction1 Example/VB/source.vb index 912cfe818e7..a6ea09aa1fc 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction1 Example/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction1 Example/VB/source.vb @@ -6,13 +6,6 @@ Imports System.Data.SqlClient Module Module1 - Sub Main() - Dim connectionString As String = _ - "Persist Security Info=False;Integrated Security=SSPI;database=Northwind;server=(local)" - ExecuteSqlTransaction(connectionString) - Console.ReadLine() - - End Sub ' Private Sub ExecuteSqlTransaction(ByVal connectionString As String) Using connection As New SqlConnection(connectionString) diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction2 Example/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction2 Example/VB/Project.vbproj index 9de5f49321c..b8fcb56ef9d 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction2 Example/VB/Project.vbproj +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction2 Example/VB/Project.vbproj @@ -1,7 +1,7 @@ - Exe + Library net8.0 diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction2 Example/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction2 Example/VB/source.vb index 0cc04ffecee..35e474a1937 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction2 Example/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction2 Example/VB/source.vb @@ -6,13 +6,6 @@ Imports System.Data.SqlClient Module Module1 - Sub Main() - Dim connectionString As String = _ - "Persist Security Info=False;Integrated Security=SSPI;database=Northwind;server=(local)" - ExecuteSqlTransaction(connectionString) - Console.ReadLine() - - End Sub ' Private Sub ExecuteSqlTransaction(ByVal connectionString As String) Using connection As New SqlConnection(connectionString) diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction3 Example/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction3 Example/VB/Project.vbproj index 9de5f49321c..b8fcb56ef9d 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction3 Example/VB/Project.vbproj +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction3 Example/VB/Project.vbproj @@ -1,7 +1,7 @@ - Exe + Library net8.0 diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction3 Example/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction3 Example/VB/source.vb index 1ef6991cc1f..458e3b99d52 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction3 Example/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlConnection.BeginTransaction3 Example/VB/source.vb @@ -6,13 +6,6 @@ Imports System.Data.SqlClient Module Module1 - Sub Main() - Dim connectionString As String = _ - "Persist Security Info=False;Integrated Security=SSPI;database=Northwind;server=(local)" - ExecuteSqlTransaction(connectionString) - Console.ReadLine() - - End Sub ' Private Sub ExecuteSqlTransaction(ByVal connectionString As String) Using connection As New SqlConnection(connectionString) diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Close Example/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Close Example/VB/Project.vbproj new file mode 100644 index 00000000000..484c85eac09 --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Close Example/VB/Project.vbproj @@ -0,0 +1,12 @@ + + + + Library + net4.8 + + + + + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Close Example/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Close Example/VB/source.vb index 436406a097f..780f1f46c96 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Close Example/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Close Example/VB/source.vb @@ -6,11 +6,6 @@ Imports System.Data.SqlClient Module Module1 - Sub Main() - Dim str As String = "Data Source=(local);Initial Catalog=Northwind;" _ - & "Integrated Security=SSPI;" - ReadOrderData(str) - End Sub ' Private Sub ReadOrderData(ByVal connectionString As String) Dim queryString As String = _ diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.GetOrdinal/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.GetOrdinal/VB/Project.vbproj new file mode 100644 index 00000000000..484c85eac09 --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.GetOrdinal/VB/Project.vbproj @@ -0,0 +1,12 @@ + + + + Library + net4.8 + + + + + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.GetOrdinal/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.GetOrdinal/VB/source.vb index d0bf9e8fbfc..4a3fd33863d 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.GetOrdinal/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.GetOrdinal/VB/source.vb @@ -6,12 +6,6 @@ Imports System.Data.SqlClient Module Module1 - Sub Main() - Dim str As String = "Data Source=(local);Initial Catalog=Northwind;" _ - & "Integrated Security=SSPI;" - ReadGetOrdinal(str) - End Sub - ' Private Sub ReadGetOrdinal(ByVal connectionString As String) Dim queryString As String = _ diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Read Example/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Read Example/VB/Project.vbproj new file mode 100644 index 00000000000..484c85eac09 --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Read Example/VB/Project.vbproj @@ -0,0 +1,12 @@ + + + + Library + net4.8 + + + + + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Read Example/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Read Example/VB/source.vb index b65366b3ed0..084d093e223 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Read Example/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData SqlDataReader.Read Example/VB/source.vb @@ -1,5 +1,4 @@ -' -Option Explicit On +Option Explicit On Option Strict On Imports System.Data @@ -7,12 +6,7 @@ Imports System.Data.SqlClient Module Module1 - Sub Main() - Dim str As String = "Data Source=(local);Initial Catalog=Northwind;" _ - & "Integrated Security=SSPI;" - ReadOrderData(str) - End Sub - + ' Private Sub ReadOrderData(ByVal connectionString As String) Dim queryString As String = _ "SELECT OrderID, CustomerID FROM dbo.Orders;" @@ -35,8 +29,7 @@ Module Module1 Private Sub ReadSingleRow(ByVal record As IDataRecord) Console.WriteLine(String.Format("{0}, {1}", record(0), record(1))) - End Sub + ' End Module -' \ No newline at end of file diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.Add/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.Add/VB/source.vb deleted file mode 100644 index f71dd4caf2a..00000000000 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.Add/VB/source.vb +++ /dev/null @@ -1,36 +0,0 @@ -Option Explicit On -Option Strict On - -Imports System.Data -Imports System.Data.Common - -Module Module1 - ' - Sub Main() - Try - Dim builder As New DbConnectionStringBuilder - builder.Add("Data Source", "ServerName") - builder.Add("Initial Catalog", "TheDatabase") - builder.Add("User ID", "UserName") - builder.Add("Password", "*******") - builder.Add("Command Logging", False) - - ' Overwrite the existing "User ID" value. - builder.Add("User ID", "NewUserName") - - ' The following code would trigger - ' an ArgumentNullException. - ' builder.Add(Nothing, "Some Value") - - Console.WriteLine(builder.ConnectionString) - - Catch ex As ArgumentNullException - Console.WriteLine("Null key values are not allowed.") - End Try - - Console.WriteLine("Press Enter to continue.") - Console.ReadLine() - End Sub - ' -End Module - diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.ConnectionString/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.ConnectionString/VB/Project.vbproj new file mode 100644 index 00000000000..706cd0177f4 --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.ConnectionString/VB/Project.vbproj @@ -0,0 +1,8 @@ + + + + Library + net4.8 + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.ConnectionString/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.ConnectionString/VB/source.vb index dfbeb49c37c..689e6367026 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.ConnectionString/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder.ConnectionString/VB/source.vb @@ -1,7 +1,5 @@ Option Explicit On Option Strict On - -Imports System.Data Imports System.Data.Common Module Module1 @@ -13,8 +11,7 @@ Module Module1 Dim builder As New DbConnectionStringBuilder() builder.Add("Data Source", "c:\MyData\MyDb.mdb") builder.Add("Provider", "Microsoft.Jet.Oledb.4.0") - builder.Add("Jet OLEDB:Database Password", "*******") - builder.Add("Jet OLEDB:System Database", _ + builder.Add("Jet OLEDB:System Database", "c:\MyData\Workgroup.mdb") ' Set up row-level locking. builder.Add("Jet OLEDB:Database Locking Mode", 1) @@ -29,24 +26,24 @@ Module Module1 ' connection string to it, to demonstrate how ' the class parses connection strings. builder.Clear() - builder.ConnectionString = _ - "Data Source=(local);Initial Catalog=AdventureWorks;" & _ + builder.ConnectionString = + "Data Source=(local);Initial Catalog=AdventureWorks;" & "Integrated Security=SSPI" - ' The DbConnectionStringBuilder class has parsed the contents, + ' The DbConnectionStringBuilder class has parsed the contents, ' so you can work with any individual key/value pair. builder("Data Source") = "." Console.WriteLine(builder.ConnectionString) Console.WriteLine() - ' Because the DbConnectionStringBuilder class doesn't + ' Because the DbConnectionStringBuilder class doesn't ' validate its key/value pairs, you can use this class ' to store any semicolon-delimited list. The following ' snippet places an arbitrary string into the ConnectionString ' property, changes one of the values, and then displays the ' resulting string. builder.Clear() - builder.ConnectionString = _ + builder.ConnectionString = "Value1=10;Value2=20;Value3=30;Value4=40" builder("Value2") = 25 Console.WriteLine(builder.ConnectionString) diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder/VB/Project.vbproj new file mode 100644 index 00000000000..706cd0177f4 --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder/VB/Project.vbproj @@ -0,0 +1,8 @@ + + + + Library + net4.8 + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder/VB/source.vb index 65a4c5b17fd..62a468327ee 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DbConnectionStringBuilder/VB/source.vb @@ -14,25 +14,22 @@ Module Module1 Dim builder As New DbConnectionStringBuilder() builder.ConnectionString = "Data Source=c:\MyData\MyDb.mdb" builder.Add("Provider", "Microsoft.Jet.Oledb.4.0") - builder.Add("Jet OLEDB:Database Password", "*******") - builder.Add("Jet OLEDB:System Database", _ - "c:\MyData\Workgroup.mdb") ' Set up row-level locking. builder.Add("Jet OLEDB:Database Locking Mode", 1) - ' Note that the DbConnectionStringBuilder class - ' is database agnostic, and it's possible to - ' build any type of connection string using + ' Note that the DbConnectionStringBuilder class + ' is database agnostic, and it's possible to + ' build any type of connection string using ' this class. - ' Notice that the ConnectionString property may have been + ' Notice that the ConnectionString property may have been ' formatted by the DbConnectionStringBuilder class. Dim oledbConnect As New _ OleDbConnection(builder.ConnectionString) Console.WriteLine(oledbConnect.ConnectionString) - ' Use the same DbConnectionStringBuilder to create + ' Use the same DbConnectionStringBuilder to create ' a SqlConnection object. builder.Clear() builder.Add("integrated security", True) @@ -42,25 +39,16 @@ Module Module1 Dim sqlConnect As New SqlConnection(builder.ConnectionString) Console.WriteLine(sqlConnect.ConnectionString) - ' Pass the DbConnectionStringBuilder an existing + ' Pass the DbConnectionStringBuilder an existing ' connection string, and you can retrieve and ' modify any of the elements. - builder.ConnectionString = _ - "server=(local);user id=*******;" & _ - "password=*******;initial catalog=AdventureWorks" + builder.ConnectionString = "server=(local);initial catalog=AdventureWorks" builder.Item("Server") = "." - builder.Remove("User ID") - ' Note that calling Remove on a nonexistent item doesn't - ' throw an exception. - builder.Remove("BadItem") - - ' 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("Integrated Security") = True - builder.Remove("password") - builder.Item("User ID") = "Hello" Console.WriteLine(builder.ConnectionString) Console.WriteLine("Press Enter to finish.") diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder.Clear/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder.Clear/VB/source.vb deleted file mode 100644 index 4c699e5f6da..00000000000 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder.Clear/VB/source.vb +++ /dev/null @@ -1,48 +0,0 @@ -Option Explicit -Option Strict - -Imports System.Data -' -Imports System.Data.OleDb - -Module Module1 - Sub Main() - Dim builder As New OleDbConnectionStringBuilder() - builder.ConnectionString = "Data Source=C:\Sample.mdb" - - ' Call the Add method to explicitly add key/value - ' pairs to the internal collection. - builder.Add("Provider", "Microsoft.Jet.Oledb.4.0") - builder.Add("Jet OLEDB:Database Password", "MyPassword!") - builder.Add("Jet OLEDB:System Database", "C:\Workgroup.mdb") - - ' Set up row-level locking. - builder.Add("Jet OLEDB:Database Locking Mode", 1) - - ' Dump the contents of the "filled-in" OleDbConnectionStringBuilder - ' to the console window. - DumpBuilderContents(builder) - - ' Clear current values and reset known keywords to their - ' default values. - builder.Clear() - - ' Dump the contents of the newly emptied - ' OleDbConnectionStringBuilder - ' to the console window. - DumpBuilderContents(builder) - - Console.WriteLine("Press Enter to continue.") - Console.ReadLine() - End Sub - - Private Sub DumpBuilderContents(ByVal builder As OleDbConnectionStringBuilder) - Console.WriteLine("=================") - Console.WriteLine("builder.ConnectionString = " & builder.ConnectionString) - For Each key As String In builder.Keys - Console.WriteLine(key & "=" & builder.Item(key).ToString) - Next - End Sub -End Module -' - diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder.Item/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder.Item/VB/Project.vbproj new file mode 100644 index 00000000000..9db400aecea --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder.Item/VB/Project.vbproj @@ -0,0 +1,12 @@ + + + + Library + net8 + + + + + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder.Item/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder.Item/VB/source.vb index 10d17931832..cc729944b68 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder.Item/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OleDbConnectionStringBuilder.Item/VB/source.vb @@ -3,7 +3,7 @@ Option Strict Imports System.Data ' -Imports System.Data.OleDb +Imports System.Data.OleDb Module Module1 Sub Main() @@ -11,7 +11,6 @@ Module Module1 builder.Provider = "Microsoft.Jet.Oledb.4.0" builder.DataSource = "C:\Sample.mdb" ' Set properties using the Item property. - builder.Item("Jet OLEDB:Database Password") = "DataPassword" builder.Item("Jet OLEDB:Encrypt Database") = True ' Because Item is the default property, you can leave out @@ -25,8 +24,8 @@ Module Module1 Console.WriteLine(builder.Item("Jet OLEDB:System database")) Console.WriteLine(builder("Jet OLEDB:Encrypt Database")) - ' You can set or retrieve any of the "default" values for the - ' provider, as well, even if you did not set their values. Again, + ' You can set or retrieve any of the "default" values for the + ' provider, as well, even if you did not set their values. Again, ' explicitly specifying the Item property name is optional. Console.WriteLine(builder.Item("Jet OLEDB:Database Locking Mode")) Console.WriteLine(builder("Jet OLEDB:Global Partial Bulk Ops")) diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.ContainsKey/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.ContainsKey/VB/Project.vbproj new file mode 100644 index 00000000000..1564968cb6e --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.ContainsKey/VB/Project.vbproj @@ -0,0 +1,12 @@ + + + + Library + net4.8 + + + + + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.ContainsKey/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.ContainsKey/VB/source.vb index 96e172add38..78dcf2592bf 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.ContainsKey/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OracleConnectionStringBuilder.ContainsKey/VB/source.vb @@ -1,42 +1,33 @@ Option Explicit -Option Strict +Option Strict On -Imports System.Data -' -' You may need to set a reference to the System.Data.OracleClient -' assembly before you can run this sample. Imports System.Data.OracleClient Module Module1 - Sub Main() - Dim builder As _ + ' + Sub Main() + Dim builder As _ New OracleConnectionStringBuilder(GetConnectionString()) - Console.WriteLine("Connection string = " & builder.ConnectionString) + Console.WriteLine("Connection string = " & builder.ConnectionString) - ' Keys you have provided return true. - Console.WriteLine(builder.ContainsKey("Integrated Security")) + ' Keys you have provided return true. + Console.WriteLine(builder.ContainsKey("Integrated Security")) - ' Comparison is case insensitive, and synonyms for the - ' keywords are translated to well-known names. - ' The following returns True because "PWD" is a - ' synonym for "Password", a valid key. - Console.WriteLine(builder.ContainsKey("PWD")) + ' Keys that are valid but have not been set return true. + Console.WriteLine(builder.ContainsKey("Unicode")) - ' Keys that are valid but have not been set return true. - Console.WriteLine(builder.ContainsKey("Unicode")) + ' Keys that don't exist return false. + Console.WriteLine(builder.ContainsKey("MyKey")) - ' Keys that don't exist return false. - Console.WriteLine(builder.ContainsKey("MyKey")) + Console.WriteLine("Press Enter to continue.") + Console.ReadLine() + End Sub - Console.WriteLine("Press Enter to continue.") - Console.ReadLine() - End Sub - - Private Function GetConnectionString() As String - ' To avoid storing the connection string in your code, - ' you can retrieve it from a configuration file. - Return "Server=OracleDemo;Integrated Security=True" - End Function + Private Function GetConnectionString() As String + ' To avoid storing the connection string in your code, + ' you can retrieve it from a configuration file. + Return "Server=OracleDemo;Integrated Security=True" + End Function + ' End Module -' diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/idatareader_nextresult/vb/Project.vbproj b/snippets/visualbasic/VS_Snippets_ADO.NET/idatareader_nextresult/vb/Project.vbproj new file mode 100644 index 00000000000..3280bd119bf --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/idatareader_nextresult/vb/Project.vbproj @@ -0,0 +1,14 @@ + + + + Library + net8 + + + + + + + + + diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/idatareader_nextresult/vb/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/idatareader_nextresult/vb/source.vb index 66eb2bd0809..58b60ca7d04 100644 --- a/snippets/visualbasic/VS_Snippets_ADO.NET/idatareader_nextresult/vb/source.vb +++ b/snippets/visualbasic/VS_Snippets_ADO.NET/idatareader_nextresult/vb/source.vb @@ -8,18 +8,12 @@ Module Module1 Dim connectionTypeName As String = "SqlClient" Dim connectionString As String = "Data Source=(local);Initial Catalog=AdventureWorks2012;Integrated Security=SSPI" - ' Dim connectionTypeName As String = "Odbc" - ' Dim connectionString As String = "Driver={SQL Server Native Client 11.0};Server=(local);Database=AdventureWorks2012;Trusted_Connection=Yes" - - ' Dim connectionTypeName As String = "OleDb" - ' Dim connectionString As String = "Provider=SQLNCLI11;Data Source=(local);Initial Catalog=AdventureWorks2012;Integrated Security=SSPI" - Sub Main() Using connection As IDbConnection = DatabaseConnectionFactory.GetConnection(connectionTypeName, connectionString) Dim command As IDbCommand = connection.CreateCommand() command.Connection = connection - 'these 2 queries are executed as a single batch and return 2 separate results + 'These 2 queries are executed as a single batch and return 2 separate results. command.CommandText = "SELECT CountryRegionCode, Name FROM Person.CountryRegion;" + "SELECT CountryRegionCode, StateProvinceCode, Name, StateProvinceID FROM Person.StateProvince;" @@ -101,4 +95,4 @@ Module Module1 End Function End Class End Module -' \ No newline at end of file +' diff --git a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSource_22sql/VB/sql22vb.aspx b/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSource_22sql/VB/sql22vb.aspx deleted file mode 100644 index 37d9a17424b..00000000000 --- a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSource_22sql/VB/sql22vb.aspx +++ /dev/null @@ -1,97 +0,0 @@ - -<%@Page Language="VB" %> -<%@Import Namespace="System.Data" %> -<%@Import Namespace="System.Data.Common" %> - - - - - - - ASP.NET Example - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From 1e1ae05bd5f773c411080a9da6b63751a1cd18e5 Mon Sep 17 00:00:00 2001 From: Kevin Jones Date: Tue, 1 Oct 2024 17:13:03 -0400 Subject: [PATCH 4/7] Purge use of RNGCryptoServiceProvider in examples (#10476) --- .../cpp/sample.cpp | 8 +-- .../HMACRIPEMD160/CPP/hmacripemd160.cpp | 3 +- .../HMACRIPEMD160/CPP/makefile | 2 + .../HMACSHA256/CPP/hmacsha256.cpp | 3 +- .../VS_Snippets_CLR/HMACSHA256/CPP/makefile | 2 + .../HMACSHA384/CPP/hmacsha384.cpp | 3 +- .../VS_Snippets_CLR/HMACSHA384/CPP/makefile | 2 + .../HMACSHA512/CPP/hmacsha512.cpp | 5 +- .../VS_Snippets_CLR/HMACSHA512/CPP/makefile | 2 + .../VS_Snippets_CLR/rfc28981/CPP/rfc28981.cpp | 4 +- .../CPP/source.cpp | 3 +- .../CPP/source.cpp | 3 +- .../CPP/rsaencoder.cpp | 4 +- .../HMACRIPEMD160/Overview/hmacripemd160.cs | 4 +- .../HMACSHA256/Overview/hmacsha256.cs | 4 +- .../HMACSHA384/Overview/hmacsha384.cs | 4 +- .../HMACSHA512/Overview/hmacsha512.cs | 4 +- .../MACTripleDES/Overview/program.cs | 4 +- .../PasswordDeriveBytes/Overview/sample.cs | 10 +-- .../Parameters/rsaencoder.cs | 4 +- .../RandomNumberGenerator/GetBytes/source.cs | 15 +++-- .../GetNonZeroBytes/source.cs | 10 +-- .../Rfc2898DeriveBytes/Overview/rfc28981.cs | 5 +- .../samlattribute/cs/Project.csproj | 14 ++++ .../VS_Snippets_CFX/samlattribute/cs/makefile | 4 -- .../samlattribute/cs/source.cs | 64 +++++++++++-------- .../samlattribute/vb/source.vb | 20 ++++-- .../VB/sample.vb | 10 +-- .../HMACRIPEMD160/vb/hmacripemd160.vb | 4 +- .../HMACSHA256/vb/hmacsha256.vb | 4 +- .../HMACSHA384/vb/hmacsha384.vb | 4 +- .../HMACSHA512/vb/hmacsha512.vb | 4 +- .../VS_Snippets_CLR/MAC3DES/VB/program.vb | 4 +- .../VS_Snippets_CLR/rfc28981/vb/rfc28981.vb | 4 +- .../VB/source.vb | 6 +- .../VB/source.vb | 7 +- .../VB/rsaencoder.vb | 4 +- 37 files changed, 147 insertions(+), 114 deletions(-) create mode 100644 snippets/cpp/VS_Snippets_CLR/HMACRIPEMD160/CPP/makefile create mode 100644 snippets/cpp/VS_Snippets_CLR/HMACSHA256/CPP/makefile create mode 100644 snippets/cpp/VS_Snippets_CLR/HMACSHA384/CPP/makefile create mode 100644 snippets/cpp/VS_Snippets_CLR/HMACSHA512/CPP/makefile create mode 100644 snippets/csharp/VS_Snippets_CFX/samlattribute/cs/Project.csproj delete mode 100644 snippets/csharp/VS_Snippets_CFX/samlattribute/cs/makefile diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.PasswordDerivedbytes/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.PasswordDerivedbytes/cpp/sample.cpp index eba4a79c828..06b5a8483db 100644 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.PasswordDerivedbytes/cpp/sample.cpp +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.PasswordDerivedbytes/cpp/sample.cpp @@ -18,12 +18,12 @@ array^ CreateRandomSalt(int length) randomBytes = gcnew array (1); } - // Create a new RNGCryptoServiceProvider. - RNGCryptoServiceProvider^ cryptoRNGProvider = - gcnew RNGCryptoServiceProvider(); + // Create a new RandomNumberGenerator. + RandomNumberGenerator^ randomNumberGenerator = + RandomNumberGenerator::Create(); // Fill the buffer with random bytes. - cryptoRNGProvider->GetBytes(randomBytes); + randomNumberGenerator->GetBytes(randomBytes); // return the bytes. return randomBytes; diff --git a/snippets/cpp/VS_Snippets_CLR/HMACRIPEMD160/CPP/hmacripemd160.cpp b/snippets/cpp/VS_Snippets_CLR/HMACRIPEMD160/CPP/hmacripemd160.cpp index 3a6a3d6403c..0f9f1c2f6ac 100644 --- a/snippets/cpp/VS_Snippets_CLR/HMACRIPEMD160/CPP/hmacripemd160.cpp +++ b/snippets/cpp/VS_Snippets_CLR/HMACRIPEMD160/CPP/hmacripemd160.cpp @@ -111,8 +111,7 @@ int main() // secret key shared by sender and receiver. array^secretkey = gcnew array(64); - //RNGCryptoServiceProvider is an implementation of a random number generator. - RNGCryptoServiceProvider^ rng = gcnew RNGCryptoServiceProvider; + RandomNumberGenerator^ rng = RandomNumberGenerator::Create(); // The array is now filled with cryptographically strong random bytes. rng->GetBytes( secretkey ); diff --git a/snippets/cpp/VS_Snippets_CLR/HMACRIPEMD160/CPP/makefile b/snippets/cpp/VS_Snippets_CLR/HMACRIPEMD160/CPP/makefile new file mode 100644 index 00000000000..35f08e9adb2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/HMACRIPEMD160/CPP/makefile @@ -0,0 +1,2 @@ +System.Security.Cryptography.HMACRIPEMD160.exe: hmacripemd160.cpp + cl /FeSystem.Security.Cryptography.HMACRIPEMD160.exe /clr:pure hmacripemd160.cpp diff --git a/snippets/cpp/VS_Snippets_CLR/HMACSHA256/CPP/hmacsha256.cpp b/snippets/cpp/VS_Snippets_CLR/HMACSHA256/CPP/hmacsha256.cpp index 72688544c68..d26844e8082 100644 --- a/snippets/cpp/VS_Snippets_CLR/HMACSHA256/CPP/hmacsha256.cpp +++ b/snippets/cpp/VS_Snippets_CLR/HMACSHA256/CPP/hmacsha256.cpp @@ -111,8 +111,7 @@ int main() // secret key shared by sender and receiver. array^secretkey = gcnew array(64); - //RNGCryptoServiceProvider is an implementation of a random number generator. - RNGCryptoServiceProvider^ rng = gcnew RNGCryptoServiceProvider; + RandomNumberGenerator^ rng = RandomNumberGenerator::Create(); // The array is now filled with cryptographically strong random bytes. rng->GetBytes( secretkey ); diff --git a/snippets/cpp/VS_Snippets_CLR/HMACSHA256/CPP/makefile b/snippets/cpp/VS_Snippets_CLR/HMACSHA256/CPP/makefile new file mode 100644 index 00000000000..c5caba97392 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/HMACSHA256/CPP/makefile @@ -0,0 +1,2 @@ +System.Security.Cryptography.HMACSHA256.exe: hmacsha256.cpp + cl /FeSystem.Security.Cryptography.HMACSHA256.exe /clr:pure hmacsha256.cpp diff --git a/snippets/cpp/VS_Snippets_CLR/HMACSHA384/CPP/hmacsha384.cpp b/snippets/cpp/VS_Snippets_CLR/HMACSHA384/CPP/hmacsha384.cpp index 0ae778597be..6dfcd8a29fa 100644 --- a/snippets/cpp/VS_Snippets_CLR/HMACSHA384/CPP/hmacsha384.cpp +++ b/snippets/cpp/VS_Snippets_CLR/HMACSHA384/CPP/hmacsha384.cpp @@ -111,8 +111,7 @@ int main() // secret key shared by sender and receiver. array^secretkey = gcnew array(64); - //RNGCryptoServiceProvider is an implementation of a random number generator. - RNGCryptoServiceProvider^ rng = gcnew RNGCryptoServiceProvider; + RandomNumberGenerator^ rng = RandomNumberGenerator::Create(); // The array is now filled with cryptographically strong random bytes. rng->GetBytes( secretkey ); diff --git a/snippets/cpp/VS_Snippets_CLR/HMACSHA384/CPP/makefile b/snippets/cpp/VS_Snippets_CLR/HMACSHA384/CPP/makefile new file mode 100644 index 00000000000..3e26e510700 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/HMACSHA384/CPP/makefile @@ -0,0 +1,2 @@ +System.Security.Cryptography.HMACSHA384.exe: hmacsha384.cpp + cl /FeSystem.Security.Cryptography.HMACSHA384.exe /clr:pure hmacsha384.cpp diff --git a/snippets/cpp/VS_Snippets_CLR/HMACSHA512/CPP/hmacsha512.cpp b/snippets/cpp/VS_Snippets_CLR/HMACSHA512/CPP/hmacsha512.cpp index 4683aaa6838..4f83ce4b8b5 100644 --- a/snippets/cpp/VS_Snippets_CLR/HMACSHA512/CPP/hmacsha512.cpp +++ b/snippets/cpp/VS_Snippets_CLR/HMACSHA512/CPP/hmacsha512.cpp @@ -110,9 +110,8 @@ int main() // Create a random key using a random number generator. This would be the // secret key shared by sender and receiver. array^secretkey = gcnew array(64); - - //RNGCryptoServiceProvider is an implementation of a random number generator. - RNGCryptoServiceProvider^ rng = gcnew RNGCryptoServiceProvider; + + RandomNumberGenerator^ rng = RandomNumberGenerator::Create(); // The array is now filled with cryptographically strong random bytes. rng->GetBytes( secretkey ); diff --git a/snippets/cpp/VS_Snippets_CLR/HMACSHA512/CPP/makefile b/snippets/cpp/VS_Snippets_CLR/HMACSHA512/CPP/makefile new file mode 100644 index 00000000000..24ac11a57ac --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/HMACSHA512/CPP/makefile @@ -0,0 +1,2 @@ +System.Security.Cryptography.HMACSHA512.exe: hmacsha512.cpp + cl /FeSystem.Security.Cryptography.HMACSHA512.exe /clr:pure hmacsha512.cpp diff --git a/snippets/cpp/VS_Snippets_CLR/rfc28981/CPP/rfc28981.cpp b/snippets/cpp/VS_Snippets_CLR/rfc28981/CPP/rfc28981.cpp index cd03e6be098..0494e4ad274 100644 --- a/snippets/cpp/VS_Snippets_CLR/rfc28981/CPP/rfc28981.cpp +++ b/snippets/cpp/VS_Snippets_CLR/rfc28981/CPP/rfc28981.cpp @@ -27,8 +27,8 @@ int main() String^ pwd1 = passwordargs[ 1 ]; array^salt1 = gcnew array(8); - RNGCryptoServiceProvider ^ rngCsp = gcnew RNGCryptoServiceProvider(); - rngCsp->GetBytes(salt1); + RandomNumberGenerator^ rng = RandomNumberGenerator::Create(); + rng->GetBytes(salt1); //data1 can be a string or contents of a file. String^ data1 = "Some test data"; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetBytes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetBytes Example/CPP/source.cpp index 8fa7d638842..9d881778d4a 100644 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetBytes Example/CPP/source.cpp +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetBytes Example/CPP/source.cpp @@ -16,8 +16,7 @@ public ref class Form1: public Form // array^ random = gcnew array(100); - //RNGCryptoServiceProvider is an implementation of a random number generator. - RNGCryptoServiceProvider^ rng = gcnew RNGCryptoServiceProvider; + RandomNumberGenerator^ rng = RandomNumberGenerator::Create(); rng->GetBytes( random ); // The array is now filled with cryptographically strong random bytes. // } diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetNonZeroBytes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetNonZeroBytes Example/CPP/source.cpp index 81410bf4726..c9dcb18468c 100644 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetNonZeroBytes Example/CPP/source.cpp +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetNonZeroBytes Example/CPP/source.cpp @@ -15,8 +15,7 @@ public ref class Form1: public Form { // array^ random = gcnew array(100); - //RNGCryptoServiceProvider is an implementation of a random number generator. - RNGCryptoServiceProvider^ rng = gcnew RNGCryptoServiceProvider; + RandomNumberGenerator^ rng = RandomNumberGenerator::Create(); rng->GetNonZeroBytes( random ); // The array is now filled with cryptographically strong random bytes, and none are zero. // } diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSAOAEPKeyExchangeDeformatter/CPP/rsaencoder.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSAOAEPKeyExchangeDeformatter/CPP/rsaencoder.cpp index 204cd71a3fd..cb8ce0d69c9 100644 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSAOAEPKeyExchangeDeformatter/CPP/rsaencoder.cpp +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSAOAEPKeyExchangeDeformatter/CPP/rsaencoder.cpp @@ -122,7 +122,7 @@ ref class RSAEncoder // Create a random number using the RNGCryptoServiceProvider provider. // - RNGCryptoServiceProvider^ ring = gcnew RNGCryptoServiceProvider; + RandomNumberGenerator^ ring = RandomNumberGenerator::Create(); rsaFormatter->Rng = ring; // @@ -190,7 +190,7 @@ int main() // // Encoding the following message: // A phrase to be encoded. -// Resulting message encoded: %?}T:v??xu?eD)YucItjwu¦ALH HB,Uj??2xq?.?s45 +// Resulting message encoded: %?}T:v??xu?eD)YucItjwu¦ALH HB,Uj??2xq?.?s45 // ?f?L2?=X?CPzWx???"q5?6&N"AE,Z+T?(]S?_7~,?G{?VV!:S?df? // Resulting message decoded: // A phrase to be encoded. diff --git a/snippets/csharp/System.Security.Cryptography/HMACRIPEMD160/Overview/hmacripemd160.cs b/snippets/csharp/System.Security.Cryptography/HMACRIPEMD160/Overview/hmacripemd160.cs index 86565762842..c7d7252d9ca 100644 --- a/snippets/csharp/System.Security.Cryptography/HMACRIPEMD160/Overview/hmacripemd160.cs +++ b/snippets/csharp/System.Security.Cryptography/HMACRIPEMD160/Overview/hmacripemd160.cs @@ -35,8 +35,8 @@ public static void Main(string[] Fileargs) // Create a random key using a random number generator. This would be the // secret key shared by sender and receiver. byte[] secretkey = new Byte[64]; - //RNGCryptoServiceProvider is an implementation of a random number generator. - using (RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider()) + + using (RandomNumberGenerator rng = RandomNumberGenerator.Create()) { // The array is now filled with cryptographically strong random bytes. rng.GetBytes(secretkey); diff --git a/snippets/csharp/System.Security.Cryptography/HMACSHA256/Overview/hmacsha256.cs b/snippets/csharp/System.Security.Cryptography/HMACSHA256/Overview/hmacsha256.cs index d5ca7e5780c..ef5f5b8c10c 100644 --- a/snippets/csharp/System.Security.Cryptography/HMACSHA256/Overview/hmacsha256.cs +++ b/snippets/csharp/System.Security.Cryptography/HMACSHA256/Overview/hmacsha256.cs @@ -35,8 +35,8 @@ public static void Main(string[] Fileargs) // Create a random key using a random number generator. This would be the // secret key shared by sender and receiver. byte[] secretkey = new Byte[64]; - //RNGCryptoServiceProvider is an implementation of a random number generator. - using (RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider()) + + using (RandomNumberGenerator rng = RandomNumberGenerator.Create()) { // The array is now filled with cryptographically strong random bytes. rng.GetBytes(secretkey); diff --git a/snippets/csharp/System.Security.Cryptography/HMACSHA384/Overview/hmacsha384.cs b/snippets/csharp/System.Security.Cryptography/HMACSHA384/Overview/hmacsha384.cs index 8a6479c66e1..deccc5c0426 100644 --- a/snippets/csharp/System.Security.Cryptography/HMACSHA384/Overview/hmacsha384.cs +++ b/snippets/csharp/System.Security.Cryptography/HMACSHA384/Overview/hmacsha384.cs @@ -35,8 +35,8 @@ public static void Main(string[] Fileargs) // Create a random key using a random number generator. This would be the // secret key shared by sender and receiver. byte[] secretkey = new Byte[64]; - //RNGCryptoServiceProvider is an implementation of a random number generator. - using (RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider()) + + using (RandomNumberGenerator rng = RandomNumberGenerator.Create()) { // The array is now filled with cryptographically strong random bytes. rng.GetBytes(secretkey); diff --git a/snippets/csharp/System.Security.Cryptography/HMACSHA512/Overview/hmacsha512.cs b/snippets/csharp/System.Security.Cryptography/HMACSHA512/Overview/hmacsha512.cs index 8852867494c..fc1581c835f 100644 --- a/snippets/csharp/System.Security.Cryptography/HMACSHA512/Overview/hmacsha512.cs +++ b/snippets/csharp/System.Security.Cryptography/HMACSHA512/Overview/hmacsha512.cs @@ -35,8 +35,8 @@ public static void Main(string[] Fileargs) // Create a random key using a random number generator. This would be the // secret key shared by sender and receiver. byte[] secretkey = new Byte[64]; - //RNGCryptoServiceProvider is an implementation of a random number generator. - using (RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider()) + + using (RandomNumberGenerator rng = RandomNumberGenerator.Create()) { // The array is now filled with cryptographically strong random bytes. rng.GetBytes(secretkey); diff --git a/snippets/csharp/System.Security.Cryptography/MACTripleDES/Overview/program.cs b/snippets/csharp/System.Security.Cryptography/MACTripleDES/Overview/program.cs index 6a4614398b5..3990c201e8c 100644 --- a/snippets/csharp/System.Security.Cryptography/MACTripleDES/Overview/program.cs +++ b/snippets/csharp/System.Security.Cryptography/MACTripleDES/Overview/program.cs @@ -35,8 +35,8 @@ public static void Main(string[] Fileargs) // Create a random key using a random number generator. This would be the // secret key shared by sender and receiver. byte[] secretkey = new Byte[24]; - //RNGCryptoServiceProvider is an implementation of a random number generator. - using (RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider()) + + using (RandomNumberGenerator rng = RandomNumberGenerator.Create()) { // The array is now filled with cryptographically strong random bytes. rng.GetBytes(secretkey); diff --git a/snippets/csharp/System.Security.Cryptography/PasswordDeriveBytes/Overview/sample.cs b/snippets/csharp/System.Security.Cryptography/PasswordDeriveBytes/Overview/sample.cs index 7fad81cff78..429ac597a62 100644 --- a/snippets/csharp/System.Security.Cryptography/PasswordDeriveBytes/Overview/sample.cs +++ b/snippets/csharp/System.Security.Cryptography/PasswordDeriveBytes/Overview/sample.cs @@ -79,11 +79,11 @@ public static byte[] CreateRandomSalt(int length) randBytes = new byte[1]; } - // Create a new RNGCryptoServiceProvider. - RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider(); - - // Fill the buffer with random bytes. - rand.GetBytes(randBytes); + using (RandomNumberGenerator rng = RandomNumberGenerator.Create()) + { + // Fill the buffer with random bytes. + rng.GetBytes(randBytes); + } // return the bytes. return randBytes; diff --git a/snippets/csharp/System.Security.Cryptography/RSAOAEPKeyExchangeDeformatter/Parameters/rsaencoder.cs b/snippets/csharp/System.Security.Cryptography/RSAOAEPKeyExchangeDeformatter/Parameters/rsaencoder.cs index abf7ebac076..5aab9d4c1cb 100644 --- a/snippets/csharp/System.Security.Cryptography/RSAOAEPKeyExchangeDeformatter/Parameters/rsaencoder.cs +++ b/snippets/csharp/System.Security.Cryptography/RSAOAEPKeyExchangeDeformatter/Parameters/rsaencoder.cs @@ -122,9 +122,9 @@ private void ConstructFormatter() rsaFormatter.SetKey(key); // - // Create a random number using the RNGCryptoServiceProvider provider. + // Create a random number using the RandomNumberGenerator // - RNGCryptoServiceProvider ring = new RNGCryptoServiceProvider(); + RandomNumberGenerator ring = RandomNumberGenerator.Create(); rsaFormatter.Rng = ring; // diff --git a/snippets/csharp/System.Security.Cryptography/RandomNumberGenerator/GetBytes/source.cs b/snippets/csharp/System.Security.Cryptography/RandomNumberGenerator/GetBytes/source.cs index a81469c2fe2..a090085f5bd 100644 --- a/snippets/csharp/System.Security.Cryptography/RandomNumberGenerator/GetBytes/source.cs +++ b/snippets/csharp/System.Security.Cryptography/RandomNumberGenerator/GetBytes/source.cs @@ -1,18 +1,19 @@ using System; using System.Data; -using System.Security.Cryptography ; +using System.Security.Cryptography; using System.Windows.Forms; public class Form1: Form { public static void Main() { - // - byte[] random = new Byte[100]; + // + byte[] random = new byte[100]; - //RNGCryptoServiceProvider is an implementation of a random number generator. - RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider(); - rng.GetBytes(random); // The array is now filled with cryptographically strong random bytes. - // + using (RandomNumberGenerator rng = RandomNumberGenerator.Create()) + { + rng.GetBytes(random); // The array is now filled with cryptographically strong random bytes. + } + // } } diff --git a/snippets/csharp/System.Security.Cryptography/RandomNumberGenerator/GetNonZeroBytes/source.cs b/snippets/csharp/System.Security.Cryptography/RandomNumberGenerator/GetNonZeroBytes/source.cs index c0c4650faed..99bd717cc20 100644 --- a/snippets/csharp/System.Security.Cryptography/RandomNumberGenerator/GetNonZeroBytes/source.cs +++ b/snippets/csharp/System.Security.Cryptography/RandomNumberGenerator/GetNonZeroBytes/source.cs @@ -8,10 +8,12 @@ public class Form1: Form public void Method() { // - byte[] random = new Byte[100]; - //RNGCryptoServiceProvider is an implementation of a random number generator. - RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider(); - rng.GetNonZeroBytes(random); // The array is now filled with cryptographically strong random bytes, and none are zero. + byte[] random = new byte[100]; + + using (RandomNumberGenerator rng = RandomNumberGenerator.Create()) + { + rng.GetNonZeroBytes(random); // The array is now filled with cryptographically strong random bytes, and none are zero. + } // } } diff --git a/snippets/csharp/System.Security.Cryptography/Rfc2898DeriveBytes/Overview/rfc28981.cs b/snippets/csharp/System.Security.Cryptography/Rfc2898DeriveBytes/Overview/rfc28981.cs index 4f3849c8289..cae652faeff 100644 --- a/snippets/csharp/System.Security.Cryptography/Rfc2898DeriveBytes/Overview/rfc28981.cs +++ b/snippets/csharp/System.Security.Cryptography/Rfc2898DeriveBytes/Overview/rfc28981.cs @@ -26,11 +26,10 @@ public static void Main(string[] passwordargs) string pwd1 = passwordargs[0]; // Create a byte array to hold the random value. byte[] salt1 = new byte[8]; - using (RNGCryptoServiceProvider rngCsp = new -RNGCryptoServiceProvider()) + using (RandomNumberGenerator rng = RandomNumberGenerator.Create()) { // Fill the array with a random value. - rngCsp.GetBytes(salt1); + rng.GetBytes(salt1); } //data1 can be a string or contents of a file. diff --git a/snippets/csharp/VS_Snippets_CFX/samlattribute/cs/Project.csproj b/snippets/csharp/VS_Snippets_CFX/samlattribute/cs/Project.csproj new file mode 100644 index 00000000000..0f78fd26319 --- /dev/null +++ b/snippets/csharp/VS_Snippets_CFX/samlattribute/cs/Project.csproj @@ -0,0 +1,14 @@ + + + + Exe + net4.8 + + + + + + + + + diff --git a/snippets/csharp/VS_Snippets_CFX/samlattribute/cs/makefile b/snippets/csharp/VS_Snippets_CFX/samlattribute/cs/makefile deleted file mode 100644 index bddebecd28f..00000000000 --- a/snippets/csharp/VS_Snippets_CFX/samlattribute/cs/makefile +++ /dev/null @@ -1,4 +0,0 @@ -all: source.exe - -source.exe: source.cs - csc /t:exe *.cs /r:System.dll,System.Configuration.dll,System.ServiceModel.dll,System.Runtime.Serialization.dll,System.IdentityModel.dll,System.Xml.dll, /lib:c:\whidbey\assemblies diff --git a/snippets/csharp/VS_Snippets_CFX/samlattribute/cs/source.cs b/snippets/csharp/VS_Snippets_CFX/samlattribute/cs/source.cs index 89bcb0a6d7e..2b238e5a29b 100644 --- a/snippets/csharp/VS_Snippets_CFX/samlattribute/cs/source.cs +++ b/snippets/csharp/VS_Snippets_CFX/samlattribute/cs/source.cs @@ -1,4 +1,4 @@ -//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- using System; @@ -80,7 +80,7 @@ protected override Collection GetIssuedClaims(RequestSecurityToke return samlAttributes; } //
- public static void Main() {} + public static void Main() { } #region Helper Methods /// @@ -139,7 +139,7 @@ private static bool CheckIfPurchaseLimitMet(string bookID) return false; List claimsets = new List(authContext.ClaimSets); - ClaimSet myClaimSet = claimsets.Find((Predicate)delegate(ClaimSet target) + ClaimSet myClaimSet = claimsets.Find((Predicate)delegate (ClaimSet target) { X509CertificateClaimSet certClaimSet = target.Issuer as X509CertificateClaimSet; return certClaimSet != null && certClaimSet.X509Certificate.Subject == "CN=HomeRealmSTS.com"; @@ -247,8 +247,8 @@ private static bool IssuedByHomeRealmSTS(ClaimSet myClaimSet) /// Abstract base class for STS implementations. /// public abstract class SecurityTokenService : ISecurityTokenService - { - string stsName; // The name of the STS. Used to populate saml:Assertion/@Issuer + { + string stsName; // The name of the STS. Used to populate saml:Assertion/@Issuer SecurityToken issuerToken; // The SecurityToken used to sign issued tokens SecurityToken proofKeyEncryptionToken; // The SecurityToken used to encrypt the proof key in the issued token. @@ -289,7 +289,7 @@ protected SecurityToken ProofKeyEncryptionToken get { return this.proofKeyEncryptionToken; } } - #region Abstract methods + #region Abstract methods /// /// Abstract method for setting up claims in the SAML Token issued by the STS @@ -322,10 +322,14 @@ protected static void EnsureRequestSecurityTokenAction(Message message) protected static BinarySecretSecurityToken CreateProofToken(int keySize) { // Create an array to store the key bytes. - byte[] key = new byte[keySize/8]; + byte[] key = new byte[keySize / 8]; + // Create some random bytes. - RNGCryptoServiceProvider random = new RNGCryptoServiceProvider(); - random.GetNonZeroBytes(key); + using (RandomNumberGenerator random = RandomNumberGenerator.Create()) + { + random.GetNonZeroBytes(key); + } + // Create a BinarySecretSecurityToken from the random bytes and return it. return new BinarySecretSecurityToken(key); } @@ -409,9 +413,12 @@ public virtual Message ProcessRequestSecurityToken(Message message) { // Create an array to store the entropy bytes. stsEntropy = new byte[keySize / 8]; + // Create some random bytes. - RNGCryptoServiceProvider random = new RNGCryptoServiceProvider(); - random.GetNonZeroBytes(stsEntropy); + using (RandomNumberGenerator random = RandomNumberGenerator.Create()) + { + random.GetNonZeroBytes(stsEntropy); + } // Compute the combined key. key = RequestSecurityTokenResponse.ComputeCombinedKey(senderEntropy, stsEntropy, keySize); } @@ -419,9 +426,12 @@ public virtual Message ProcessRequestSecurityToken(Message message) { // Create an array to store the entropy bytes. key = new byte[keySize / 8]; + // Create some random bytes. - RNGCryptoServiceProvider random = new RNGCryptoServiceProvider(); - random.GetNonZeroBytes(key); + using (RandomNumberGenerator random = RandomNumberGenerator.Create()) + { + random.GetNonZeroBytes(key); + } } // Create a BinarySecretSecurityToken to be the proof token, based on the key material @@ -846,14 +856,14 @@ private static EndpointAddress ProcessAppliesToElement(XmlReader xr) !xr.IsEmptyElement && XmlNodeType.Element == xr.NodeType) { - // + // // Create a DataContractSerializer for an EndpointAddress10. DataContractSerializer dcs = new DataContractSerializer(typeof(EndpointAddress10)); // Read the EndpointAddress10 from the DataContractSerializer. EndpointAddress10 ea10 = (EndpointAddress10)dcs.ReadObject(xr, false); // Convert the EndpointAddress10 into an EndpointAddress. ea = ea10.ToEndpointAddress(); - // + // } // Look for the end-tag that corresponds to the start-tag that the reader was positioned @@ -1064,7 +1074,7 @@ public static byte[] ComputeCombinedKey(byte[] requestorEntropy, byte[] issuerEn byte[] a = issuerEntropy; // A(0) byte[] b = new byte[kha.HashSize / 8 + a.Length]; // Buffer for A(i) + seed - for (int i = 0; i < key.Length; ) + for (int i = 0; i < key.Length;) { // Calculate A(i+1). kha.Initialize(); @@ -1348,20 +1358,20 @@ class ServiceConstants /// public static void LoadAppSettings() { -/* - BookDB = ConfigurationManager.AppSettings["bookDB"]; - CheckIfLoaded(BookDB); - BookDB = string.Format("{0}\\{1}", System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath, BookDB); + /* + BookDB = ConfigurationManager.AppSettings["bookDB"]; + CheckIfLoaded(BookDB); + BookDB = string.Format("{0}\\{1}", System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath, BookDB); - CertDistinguishedName = ConfigurationManager.AppSettings["certDistinguishedName"]; - CheckIfLoaded(CertDistinguishedName); + CertDistinguishedName = ConfigurationManager.AppSettings["certDistinguishedName"]; + CheckIfLoaded(CertDistinguishedName); - TargetDistinguishedName = ConfigurationManager.AppSettings["targetDistinguishedName"]; - CheckIfLoaded(TargetDistinguishedName); + TargetDistinguishedName = ConfigurationManager.AppSettings["targetDistinguishedName"]; + CheckIfLoaded(TargetDistinguishedName); - IssuerDistinguishedName = ConfigurationManager.AppSettings["issuerDistinguishedName"]; - CheckIfLoaded(IssuerDistinguishedName); - */ + IssuerDistinguishedName = ConfigurationManager.AppSettings["issuerDistinguishedName"]; + CheckIfLoaded(IssuerDistinguishedName); + */ } /// diff --git a/snippets/visualbasic/VS_Snippets_CFX/samlattribute/vb/source.vb b/snippets/visualbasic/VS_Snippets_CFX/samlattribute/vb/source.vb index 6871053d457..3edb9024cca 100644 --- a/snippets/visualbasic/VS_Snippets_CFX/samlattribute/vb/source.vb +++ b/snippets/visualbasic/VS_Snippets_CFX/samlattribute/vb/source.vb @@ -320,9 +320,12 @@ Namespace Microsoft.ServiceModel.Samples.Federation Protected Shared Function CreateProofToken(ByVal keySize As Integer) As BinarySecretSecurityToken ' Create an array to store the key bytes. Dim key(keySize / 8 - 1) As Byte + ' Create some random bytes. - Dim random As New RNGCryptoServiceProvider() - random.GetNonZeroBytes(key) + Using random As RandomNumberGenerator = RandomNumberGenerator.Create() + random.GetNonZeroBytes(key) + End Using + ' Create a BinarySecretSecurityToken from the random bytes and return it. Return New BinarySecretSecurityToken(key) End Function @@ -398,18 +401,23 @@ Namespace Microsoft.ServiceModel.Samples.Federation If Not (senderEntropy Is Nothing) Then ' Create an array to store the entropy bytes. stsEntropy = New Byte(keySize / 8) {} + ' Create some random bytes. - Dim random As New RNGCryptoServiceProvider() - random.GetNonZeroBytes(stsEntropy) + Using random As RandomNumberGenerator = RandomNumberGenerator.Create() + random.GetNonZeroBytes(stsEntropy) + End Using + ' Compute the combined key. key = RequestSecurityTokenResponse.ComputeCombinedKey(senderEntropy, stsEntropy, keySize) ' Issuer entropy only... Else ' Create an array to store the entropy bytes. key = New Byte(keySize / 8) {} + ' Create some random bytes. - Dim random As New RNGCryptoServiceProvider() - random.GetNonZeroBytes(key) + Using random As RandomNumberGenerator = RandomNumberGenerator.Create() + random.GetNonZeroBytes(key) + End Using End If ' Create a BinarySecretSecurityToken to be the proof token, based on the key material diff --git a/snippets/visualbasic/VS_Snippets_CLR/Cryptography.PasswordDerivedbytes/VB/sample.vb b/snippets/visualbasic/VS_Snippets_CLR/Cryptography.PasswordDerivedbytes/VB/sample.vb index 2344af9234b..611a25a8663 100644 --- a/snippets/visualbasic/VS_Snippets_CLR/Cryptography.PasswordDerivedbytes/VB/sample.vb +++ b/snippets/visualbasic/VS_Snippets_CLR/Cryptography.PasswordDerivedbytes/VB/sample.vb @@ -71,11 +71,11 @@ Module PasswordDerivedBytesExample randBytes = New Byte(0) {} End If - ' Create a new RNGCryptoServiceProvider. - Dim rand As New RNGCryptoServiceProvider() - - ' Fill the buffer with random bytes. - rand.GetBytes(randBytes) + ' Create a new RandomNumberGenerator. + Using rand As RandomNumberGenerator = RandomNumberGenerator.Create() + ' Fill the buffer with random bytes. + rand.GetBytes(randBytes) + End Using ' return the bytes. Return randBytes diff --git a/snippets/visualbasic/VS_Snippets_CLR/HMACRIPEMD160/vb/hmacripemd160.vb b/snippets/visualbasic/VS_Snippets_CLR/HMACRIPEMD160/vb/hmacripemd160.vb index 8e4eadd9ab7..0150a05e210 100644 --- a/snippets/visualbasic/VS_Snippets_CLR/HMACRIPEMD160/vb/hmacripemd160.vb +++ b/snippets/visualbasic/VS_Snippets_CLR/HMACRIPEMD160/vb/hmacripemd160.vb @@ -27,8 +27,8 @@ Public Class HMACRIPEMD160example ' Create a random key using a random number generator. This would be the ' secret key shared by sender and receiver. Dim secretkey() As Byte = New [Byte](63) {} - 'RNGCryptoServiceProvider is an implementation of a random number generator. - Using rng As New RNGCryptoServiceProvider() + + Using rng As RandomNumberGenerator = RandomNumberGenerator.Create() ' The array is now filled with cryptographically strong random bytes. rng.GetBytes(secretkey) diff --git a/snippets/visualbasic/VS_Snippets_CLR/HMACSHA256/vb/hmacsha256.vb b/snippets/visualbasic/VS_Snippets_CLR/HMACSHA256/vb/hmacsha256.vb index aa26942d9b2..361d5df38f0 100644 --- a/snippets/visualbasic/VS_Snippets_CLR/HMACSHA256/vb/hmacsha256.vb +++ b/snippets/visualbasic/VS_Snippets_CLR/HMACSHA256/vb/hmacsha256.vb @@ -27,8 +27,8 @@ Public Class HMACSHA256example ' Create a random key using a random number generator. This would be the ' secret key shared by sender and receiver. Dim secretkey() As Byte = New [Byte](63) {} - 'RNGCryptoServiceProvider is an implementation of a random number generator. - Using rng As New RNGCryptoServiceProvider() + + Using rng As RandomNumberGenerator = RandomNumberGenerator.Create() ' The array is now filled with cryptographically strong random bytes. rng.GetBytes(secretkey) diff --git a/snippets/visualbasic/VS_Snippets_CLR/HMACSHA384/vb/hmacsha384.vb b/snippets/visualbasic/VS_Snippets_CLR/HMACSHA384/vb/hmacsha384.vb index b0162858527..032f283fb19 100644 --- a/snippets/visualbasic/VS_Snippets_CLR/HMACSHA384/vb/hmacsha384.vb +++ b/snippets/visualbasic/VS_Snippets_CLR/HMACSHA384/vb/hmacsha384.vb @@ -27,8 +27,8 @@ Public Class HMACSHA384example ' Create a random key using a random number generator. This would be the ' secret key shared by sender and receiver. Dim secretkey() As Byte = New [Byte](63) {} - 'RNGCryptoServiceProvider is an implementation of a random number generator. - Using rng As New RNGCryptoServiceProvider() + + Using rng As RandomNumberGenerator = RandomNumberGenerator.Create() ' The array is now filled with cryptographically strong random bytes. rng.GetBytes(secretkey) diff --git a/snippets/visualbasic/VS_Snippets_CLR/HMACSHA512/vb/hmacsha512.vb b/snippets/visualbasic/VS_Snippets_CLR/HMACSHA512/vb/hmacsha512.vb index c91328f5fed..ebc9962d69f 100644 --- a/snippets/visualbasic/VS_Snippets_CLR/HMACSHA512/vb/hmacsha512.vb +++ b/snippets/visualbasic/VS_Snippets_CLR/HMACSHA512/vb/hmacsha512.vb @@ -27,8 +27,8 @@ Public Class HMACSHA5126example ' Create a random key using a random number generator. This would be the ' secret key shared by sender and receiver. Dim secretkey() As Byte = New [Byte](63) {} - 'RNGCryptoServiceProvider is an implementation of a random number generator. - Using rng As New RNGCryptoServiceProvider() + + Using rng As RandomNumberGenerator = RandomNumberGenerator.Create() ' The array is now filled with cryptographically strong random bytes. rng.GetBytes(secretkey) diff --git a/snippets/visualbasic/VS_Snippets_CLR/MAC3DES/VB/program.vb b/snippets/visualbasic/VS_Snippets_CLR/MAC3DES/VB/program.vb index 8daea1441d2..717c2a2367c 100644 --- a/snippets/visualbasic/VS_Snippets_CLR/MAC3DES/VB/program.vb +++ b/snippets/visualbasic/VS_Snippets_CLR/MAC3DES/VB/program.vb @@ -27,8 +27,8 @@ Public Class MACTripleDESexample ' Create a random key using a random number generator. This would be the ' secret key shared by sender and receiver. Dim secretkey() As Byte = New [Byte](23) {} - 'RNGCryptoServiceProvider is an implementation of a random number generator. - Using rng As New RNGCryptoServiceProvider() + + Using rng As RandomNumberGenerator = RandomNumberGenerator.Create() ' The array is now filled with cryptographically strong random bytes. rng.GetBytes(secretkey) diff --git a/snippets/visualbasic/VS_Snippets_CLR/rfc28981/vb/rfc28981.vb b/snippets/visualbasic/VS_Snippets_CLR/rfc28981/vb/rfc28981.vb index 653476ec08d..999cab698cb 100644 --- a/snippets/visualbasic/VS_Snippets_CLR/rfc28981/vb/rfc28981.vb +++ b/snippets/visualbasic/VS_Snippets_CLR/rfc28981/vb/rfc28981.vb @@ -22,8 +22,8 @@ Public Class rfc2898test Dim pwd1 As String = passwordargs(0) Dim salt1(8) As Byte - Using rngCsp As New RNGCryptoServiceProvider() - rngCsp.GetBytes(salt1) + Using rng As RandomNumberGenerator = RandomNumberGenerator.Create() + rng.GetBytes(salt1) End Using 'data1 can be a string or contents of a file. Dim data1 As String = "Some test data" diff --git a/snippets/visualbasic/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetBytes Example/VB/source.vb b/snippets/visualbasic/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetBytes Example/VB/source.vb index 3789927d87a..2ac319faffc 100644 --- a/snippets/visualbasic/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetBytes Example/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetBytes Example/VB/source.vb @@ -9,9 +9,9 @@ Public Class Form1 ' Dim random() As Byte = New Byte(100) {} - 'RNGCryptoServiceProvider is an implementation of an RNG - Dim rng As New RNGCryptoServiceProvider() - rng.GetBytes(random) ' bytes in random are now random + Using rng As RandomNumberGenerator = RandomNumberGenerator.Create() + rng.GetBytes(random) ' bytes in random are now random + End Using ' End Sub End Class diff --git a/snippets/visualbasic/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetNonZeroBytes Example/VB/source.vb b/snippets/visualbasic/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetNonZeroBytes Example/VB/source.vb index 975a1d7a382..328fdee0044 100644 --- a/snippets/visualbasic/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetNonZeroBytes Example/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetNonZeroBytes Example/VB/source.vb @@ -8,9 +8,10 @@ Public Class Form1 Public Sub Method() ' Dim random() As Byte = New Byte(100) {} - 'RNGCryptoServiceProvider is an implementation of an RNG - Dim rng As New RNGCryptoServiceProvider() - rng.GetNonZeroBytes(random) ' bytes in random are now random and none are zero + + Using rng As RandomNumberGenerator = RandomNumberGenerator.Create() + rng.GetNonZeroBytes(random) ' bytes in random are now random and none are zero + End Using ' End Sub End Class diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Cryptography.RSAOAEPKeyExchangeDeformatter/VB/rsaencoder.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Cryptography.RSAOAEPKeyExchangeDeformatter/VB/rsaencoder.vb index 0ef5c64e438..52f9cfad7c3 100644 --- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Cryptography.RSAOAEPKeyExchangeDeformatter/VB/rsaencoder.vb +++ b/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Cryptography.RSAOAEPKeyExchangeDeformatter/VB/rsaencoder.vb @@ -116,9 +116,9 @@ Public Class Form1 rsaFormatter.SetKey(key) ' - ' Create a random number using the RNGCryptoServiceProvider provider. + ' Create a random number using the RandomNumberGenerator. ' - Dim ring As New RNGCryptoServiceProvider + Dim ring As RandomNumberGenerator = RandomNumberGenerator.Create() rsaFormatter.Rng = ring ' From 75d9d50738997b6618a764cd2d82408ea0e95958 Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Tue, 1 Oct 2024 18:07:21 -0400 Subject: [PATCH 5/7] fix default parent node for selenium (#10482) --- quest-config.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quest-config.json b/quest-config.json index bd29a6f9b1a..438a990976d 100644 --- a/quest-config.json +++ b/quest-config.json @@ -24,7 +24,7 @@ }, { "Semester": "Selenium", - "ParentNodeId": 286016 + "ParentNodeId": 308199 }, { "Label": "user-feedback", @@ -45,5 +45,5 @@ "ParentNodeId": 227485 } ], - "DefaultParentNode": 286016 + "DefaultParentNode": 308199 } From 480587aad65d35acd30ca49bb1ceef74c9127aac Mon Sep 17 00:00:00 2001 From: IngweLand Date: Wed, 2 Oct 2024 05:10:58 +0200 Subject: [PATCH 6/7] Fix typo in HttpClientHandler.xml (#10410) Fixed duplicated text --- xml/System.Net.Http/HttpClientHandler.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xml/System.Net.Http/HttpClientHandler.xml b/xml/System.Net.Http/HttpClientHandler.xml index 15709145236..b31489e04c1 100644 --- a/xml/System.Net.Http/HttpClientHandler.xml +++ b/xml/System.Net.Http/HttpClientHandler.xml @@ -1274,7 +1274,7 @@ handler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousA Gets a value that indicates whether the handler supports automatic response content decompression. - if the if the handler supports automatic response content decompression; otherwise . The default value is . + if the handler supports automatic response content decompression; otherwise . The default value is . To be added. From a2b27b0fcbcc040093f74929f74dfb02fc4e957e Mon Sep 17 00:00:00 2001 From: Jonathan Date: Wed, 2 Oct 2024 05:14:05 +0200 Subject: [PATCH 7/7] Update MediaTypeNames+Image.xml (#10366) Fix casing of WebP from WEBP to WebP. --- xml/System.Net.Mime/MediaTypeNames+Image.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xml/System.Net.Mime/MediaTypeNames+Image.xml b/xml/System.Net.Mime/MediaTypeNames+Image.xml index 37b548dfafb..31c70ef8083 100644 --- a/xml/System.Net.Mime/MediaTypeNames+Image.xml +++ b/xml/System.Net.Mime/MediaTypeNames+Image.xml @@ -285,7 +285,7 @@ System.String - Specifies that the data is in WEBP format. + Specifies that the data is in WebP format. To be added.