diff --git a/docs/framework/data/adonet/ado-net-code-examples.md b/docs/framework/data/adonet/ado-net-code-examples.md index 29a8641702626..d3241c8a94ba5 100644 --- a/docs/framework/data/adonet/ado-net-code-examples.md +++ b/docs/framework/data/adonet/ado-net-code-examples.md @@ -63,8 +63,9 @@ The code listings in this topic demonstrate how to retrieve data from a database ### Odbc The code in this example assumes that you can connect to the Microsoft Access Northwind sample database. The code creates a to select rows from the Products table, adding a to restrict the results to rows with a UnitPrice greater than the specified parameter value, in this case 5. The is opened inside of a `using` block, which ensures that resources are closed and disposed when the code exits. The executes the command by using a , and displays the results in the console window. - - +[!code-csharp[DataWorks SampleApp.Odbc#1](../../../../samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SampleApp.Odbc/CS/source.cs#1)] +[!code-vb[DataWorks SampleApp.Odbc#1](../../../../samples/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks SampleApp.Odbc/VB/source.vb#1)] + [[Top]](#_TOP) @@ -83,7 +84,7 @@ The code listings in this topic demonstrate how to retrieve data from a database ### LINQ to Entities The code in this example uses a LINQ query to return data as Categories objects, which are projected as an anonymous type that contains only the CategoryID and CategoryName properties. For more information, see [LINQ to Entities Overview](http://msdn.microsoft.com/en-us/86d87a27-c17a-45ac-b28d-72c8500333c6). -``` +```vb Option Explicit On Option Strict On @@ -115,9 +116,7 @@ Class LinqSample End Class ``` - In C#: - -``` +```csharp using System; using System.Linq; using System.Data.Objects; @@ -159,7 +158,7 @@ class LinqSample ### Typed ObjectQuery The code in this example uses an to return data as Categories objects. For more information, see [Object Queries](http://msdn.microsoft.com/en-us/0768033c-876f-471d-85d5-264884349276). -``` +```vb Option Explicit On Option Strict On @@ -182,9 +181,7 @@ Class ObjectQuerySample End Class ``` - In C#: - -``` +```csharp using System; using System.Data.Objects; using NorthwindModel; @@ -214,7 +211,7 @@ class ObjectQuerySample ### EntityClient The code in this example uses an to execute an Entity SQL query. This query returns a list of records that represent instances of the Categories entity type. An is used to access data records in the result set. For more information, see [EntityClient Provider for the Entity Framework](../../../../docs/framework/data/adonet/ef/entityclient-provider-for-the-entity-framework.md). -``` +```vb Option Explicit On Option Strict On @@ -253,9 +250,7 @@ Class EntityClientSample End Class ``` - In C#" - -``` +```csharp using System; using System.Data; using System.Data.Common; @@ -303,7 +298,7 @@ class EntityClientSample ## LINQ to SQL The code in this example uses a LINQ query to return data as Categories objects, which are projected as an anonymous type that contains only the CategoryID and CategoryName properties. This example is based on the Northwind data context. For more information, see [Getting Started](../../../../docs/framework/data/adonet/sql/linq/getting-started.md). -``` +```vb Option Explicit On Option Strict On @@ -336,9 +331,7 @@ Class LinqSqlSample End Class ``` - In C#: - -``` +```csharp using System; using System.Collections.Generic; using System.Linq; diff --git a/docs/framework/data/adonet/method-based-query-syntax-examples-element-operators.md b/docs/framework/data/adonet/method-based-query-syntax-examples-element-operators.md index 459e854e55d41..e5c723d6d1b1a 100644 --- a/docs/framework/data/adonet/method-based-query-syntax-examples-element-operators.md +++ b/docs/framework/data/adonet/method-based-query-syntax-examples-element-operators.md @@ -24,8 +24,9 @@ The examples in this topic demonstrate how to use the - +[!code-csharp[DP LINQ to DataSet Examples#ImportsUsing](../../../../samples/snippets/csharp/VS_Snippets_ADO.NET/DP LINQ to DataSet Examples/CS/Program.cs#importsusing)] +[!code-vb[DP LINQ to DataSet Examples#ImportsUsing](../../../../samples/snippets/visualbasic/VS_Snippets_ADO.NET/DP LINQ to DataSet Examples/VB/Module1.vb#importsusing)] + For more information, see [How to: Create a LINQ to DataSet Project In Visual Studio](../../../../docs/framework/data/adonet/how-to-create-a-linq-to-dataset-project-in-vs.md). ## ElementAt @@ -33,14 +34,16 @@ The examples in this topic demonstrate how to use the method to retrieve the fifth address where `PostalCode` == "M4B 1V7". - +[!code-csharp[DP LINQ to DataSet Examples#ElementAt](../../../../samples/snippets/csharp/VS_Snippets_ADO.NET/DP LINQ to DataSet Examples/CS/Program.cs#elementat)] +[!code-vb[DP LINQ to DataSet Examples#ElementAt](../../../../samples/snippets/visualbasic/VS_Snippets_ADO.NET/DP LINQ to DataSet Examples/VB/Module1.vb#elementat)] ## First ### Example This example uses the method to return the first contact whose first name is 'Brooke'. - +[!code-csharp[DP LINQ to DataSet Examples#FirstSimple](../../../../samples/snippets/csharp/VS_Snippets_ADO.NET/DP LINQ to DataSet Examples/CS/Program.cs#firstsimple)] +[!code-vb[DP LINQ to DataSet Examples#FirstSimple](../../../../samples/snippets/visualbasic/VS_Snippets_ADO.NET/DP LINQ to DataSet Examples/VB/Module1.vb#firstsimple)] ## See Also [Loading Data Into a DataSet](../../../../docs/framework/data/adonet/loading-data-into-a-dataset.md) diff --git a/docs/framework/data/adonet/query-expression-syntax-examples-restriction-linq-to-dataset.md b/docs/framework/data/adonet/query-expression-syntax-examples-restriction-linq-to-dataset.md index 6424ada428837..e92d2f1653670 100644 --- a/docs/framework/data/adonet/query-expression-syntax-examples-restriction-linq-to-dataset.md +++ b/docs/framework/data/adonet/query-expression-syntax-examples-restriction-linq-to-dataset.md @@ -24,7 +24,7 @@ The examples in this topic demonstrate how to use the +[!code-csharp[DP LINQ to DataSetExamples#ImportsUsing](../../../../samples/snippets/csharp/VS_Snippets_ADO.NET/DP LINQ to DataSet Examples/CS/Program.cs#importsusing)] For more information, see [How to: Create a LINQ to DataSet Project In Visual Studio](../../../../docs/framework/data/adonet/how-to-create-a-linq-to-dataset-project-in-vs.md). @@ -33,25 +33,26 @@ The examples in this topic demonstrate how to use the method to find orders that were made after December 1, 2002 and then uses the method to get the details for each order. - + [!code-csharp[DP LINQ to DataSetExamples#WhereDrillDown](../../../../samples/snippets/csharp/VS_Snippets_ADO.NET/DP LINQ to DataSet Examples/CS/Program.cs#wheredrilldown)] + [!code-vb[DP LINQ to DataSet Examples#WhereDrillDown](../../../../samples/snippets/visualbasic/VS_Snippets_ADO.NET/DP LINQ to DataSet Examples/VB/Module1.vb#wheredrilldown)] ## See Also [Loading Data Into a DataSet](../../../../docs/framework/data/adonet/loading-data-into-a-dataset.md) diff --git a/docs/framework/data/adonet/single-table-queries-linq-to-dataset.md b/docs/framework/data/adonet/single-table-queries-linq-to-dataset.md index 6d3572a381ec0..79c949b767385 100644 --- a/docs/framework/data/adonet/single-table-queries-linq-to-dataset.md +++ b/docs/framework/data/adonet/single-table-queries-linq-to-dataset.md @@ -20,7 +20,8 @@ manager: "jhubbard" The following example gets all the online orders from the SalesOrderHeader table and outputs the order ID, order date, and order number to the console. - + [!code-csharp[DP LINQ to DataSet Examples#Where1](../../../../samples/snippets/csharp/VS_Snippets_ADO.NET/DP LINQ to DataSet Examples/CS/Program.cs#where1)] + [!code-vb[DP LINQ to DataSet Examples#Where1](../../../../samples/snippets/visualbasic/VS_Snippets_ADO.NET/DP LINQ to DataSet Examples/VB/Module1.vb#where1)] The local variable query is initialized with a query expression, which operates on one or more information sources by applying one or more query operators from either the standard query operators or, in the case of [!INCLUDE[linq_dataset](../../../../includes/linq-dataset-md.md)], operators specific to the class. The query expression in the previous example uses two of the standard query operators: `Where` and `Select`. diff --git a/docs/framework/data/wcf/linq-considerations-wcf-data-services.md b/docs/framework/data/wcf/linq-considerations-wcf-data-services.md index 345ffccc926d3..71d288c582782 100644 --- a/docs/framework/data/wcf/linq-considerations-wcf-data-services.md +++ b/docs/framework/data/wcf/linq-considerations-wcf-data-services.md @@ -30,7 +30,8 @@ This topic provides information about the way in which LINQ queries are composed The following example is a LINQ query that returns `Orders` that have a freight cost of more than $30 and sorts the results by the shipping date, starting with the latest ship date: - +[!code-csharp[Astoria Northwind Client#AddQueryOptionsLinqSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/source.cs#addqueryoptionslinqspecific)] +[!code-vb[Astoria Northwind Client#AddQueryOptionsLinqSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria northwind client/vb/source.vb#addqueryoptionslinqspecific)] This LINQ query is translated into the following query URI that is executed against the Northwind-based [quickstart](../../../../docs/framework/data/wcf/quickstart-wcf-data-services.md) data service: @@ -42,7 +43,8 @@ http://localhost:12345/Northwind.svc/Orders?Orderby=ShippedDate&?filter=Freight LINQ enables you to compose queries by using both the language-specific declarative query syntax, shown in the previous example, as well as a set of query methods known as standard query operators. An equivalent query to the previous example can be composed by using only the method-based syntax, as shown the following example: - +[!code-csharp[Astoria Northwind Client#AddQueryOptionsLinqExpressionSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/source.cs#addqueryoptionslinqexpressionspecific)] +[!code-vb[Astoria Northwind Client#AddQueryOptionsLinqExpressionSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria northwind client/vb/source.vb#addqueryoptionslinqexpressionspecific)] The [!INCLUDE[ssAstoria](../../../../includes/ssastoria-md.md)] client is able to translate both kinds of composed queries into a query URI, and you can extend a LINQ query by appending query methods to a query expression. When you compose LINQ queries by appending method syntax to a query expression or a , the operations are added to the query URI in the order in which methods are called. This is equivalent to calling the method to add each query option to the query URI. @@ -64,15 +66,18 @@ http://localhost:12345/Northwind.svc/Orders?Orderby=ShippedDate&?filter=Freight - Using LINQ query syntax: - +[!code-csharp[Astoria Northwind Client#LinqWhereClauseSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/source.cs#linqwhereclausespecific)] +[!code-vb[Astoria Northwind Client#LinqWhereClauseSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria northwind client/vb/source.vb#linqwhereclausespecific)] - Using LINQ query methods: - +[!code-csharp[Astoria Northwind Client#LinqWhereMethodSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/source.cs#linqwheremethodspecific)] +[!code-vb[Astoria Northwind Client#LinqWhereMethodSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria northwind client/vb/source.vb#linqwheremethodspecific)] - The URI query string `$filter` option: - +[!code-csharp[Astoria Northwind Client#ExplicitQueryWhereMethodSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/source.cs#explicitquerywheremethodspecific)] +[!code-vb[Astoria Northwind Client#ExplicitQueryWhereMethodSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria northwind client/vb/source.vb#explicitquerywheremethodspecific)] All of the previous examples are translated to the query URI: `http://localhost:12345/northwind.svc/Orders()?$filter=Freight gt 30M`. @@ -82,15 +87,18 @@ http://localhost:12345/Northwind.svc/Orders?Orderby=ShippedDate&?filter=Freight - Using LINQ query syntax: - +[!code-csharp[Astoria Northwind Client#LinqOrderByClauseSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/source.cs#linqorderbyclausespecific)] +[!code-vb[Astoria Northwind Client#LinqOrderByClauseSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria northwind client/vb/source.vb#linqorderbyclausespecific)] - Using LINQ query methods: - +[!code-csharp[Astoria Northwind Client#LinqOrderByMethodSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/source.cs#linqorderbymethodspecific)] +[!code-vb[Astoria Northwind Client#LinqOrderByMethodSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria northwind client/vb/source.vb#linqorderbymethodspecific)] - URI query string `$orderby` option): - +[!code-csharp[Astoria Northwind Client#ExplicitQueryOrderByMethodSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/source.cs#explicitqueryorderbymethodspecific)] +[!code-vb[Astoria Northwind Client#ExplicitQueryOrderByMethodSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria northwind client/vb/source.vb#explicitqueryorderbymethodspecific)] All of the previous examples are translated to the query URI: `http://localhost:12345/northwind.svc/Customers()?$orderby=CompanyName,PostalCode desc`. @@ -100,11 +108,14 @@ http://localhost:12345/Northwind.svc/Orders?Orderby=ShippedDate&?filter=Freight - Using LINQ query syntax: - +[!code-csharp[Astoria Northwind Client#LinqSelectClauseSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/source.cs#linqselectclausespecific)] +[!code-vb[Astoria Northwind Client#LinqSelectClauseSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria northwind client/vb/source.vb#linqselectclausespecific)] - Using LINQ query methods: - +[!code-csharp[Astoria Northwind Client#LinqSelectMethodSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/source.cs#linqselectmethodspecific)] +[!code-vb[Astoria Northwind Client#LinqSelectMethodSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria northwind client/vb/source.vb#linqselectmethodspecific)] + > [!NOTE] > The `$select` query option cannot be added to a query URI by using the method. We recommend that you use the LINQ method to have the client generate the `$select` query option in the request URI. @@ -117,11 +128,13 @@ http://localhost:12345/Northwind.svc/Orders?Orderby=ShippedDate&?filter=Freight - Applying query methods to a LINQ query: - +[!code-csharp[Astoria Northwind Client#LinqSkipTakeMethodSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/source.cs#linqskiptakemethodspecific)] +[!code-vb[Astoria Northwind Client#LinqSkipTakeMethodSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria northwind client/vb/source.vb#linqskiptakemethodspecific)] - URI query string `$skip` and `$top` options): - +[!code-csharp[Astoria Northwind Client#ExplicitQuerySkipTakeMethodSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/source.cs#explicitqueryskiptakemethodspecific)] +[!code-vb[Astoria Northwind Client#ExplicitQuerySkipTakeMethodSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria northwind client/vb/source.vb#explicitqueryskiptakemethodspecific)] Both of the previous examples are translated to the query URI: `http://localhost:12345/northwind.svc/Orders()?$orderby=OrderDate desc&$skip=50&$top=25`. @@ -133,11 +146,14 @@ http://localhost:12345/Northwind.svc/Orders?Orderby=ShippedDate&?filter=Freight - In LINQ query syntax: - +[!code-csharp[Astoria Northwind Client#LinqQueryExpandSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/source.cs#linqqueryexpandspecific)] +[!code-vb[Astoria Northwind Client#LinqQueryExpandSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria northwind client/vb/source.vb#linqqueryexpandspecific)] - With LINQ query methods: + +[!code-csharp[Astoria Northwind Client#LinqQueryExpandMethodSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/source.cs#linqqueryexpandmethodspecific)] +[!code-vb[Astoria Northwind Client#LinqQueryExpandMethodSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria northwind client/vb/source.vb#linqqueryexpandmethodspecific)] - Both of the previous examples are translated to the query URI: `http://localhost:12345/northwind.svc/Orders()?$filter=CustomerID eq 'ALFKI'&$expand=Order_Details`. @@ -193,7 +209,7 @@ http://localhost:12345/Northwind.svc/Orders?Orderby=ShippedDate&?filter=Freight ||`decimal round(decimal p0)`| ||`double round(double p0)`| -| System.Linq.Expressions.Expression?qualifyHint=False&autoUpgrade=True Member|Supported [!INCLUDE[ssODataShort](../../../../includes/ssodatashort-md.md)] Function| +| Member|Supported [!INCLUDE[ssODataShort](../../../../includes/ssodatashort-md.md)] Function| |---------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------| ||`bool isof(type p0)`| diff --git a/docs/framework/interop/platform-invoke-examples.md b/docs/framework/interop/platform-invoke-examples.md index 24ec3b90bc41b..05525a97c1e95 100644 --- a/docs/framework/interop/platform-invoke-examples.md +++ b/docs/framework/interop/platform-invoke-examples.md @@ -30,9 +30,9 @@ manager: "wpickett" # Platform Invoke Examples The following examples demonstrate how to define and call the **MessageBox** function in User32.dll, passing a simple string as an argument. In the examples, the field is set to **Auto** to let the target platform determine the character width and string marshaling. - - [!code-csharp[Conceptual.Interop.PInvoke#1](../../../samples/snippets/csharp/VS_Snippets_CLR/Conceptual.Interop.PInvoke/cs/Example1.cs#1)] - [!code-vb[Conceptual.Interop.PInvoke#1](../../../samples/snippets/visualbasic/VS_Snippets_CLR/Conceptual.Interop.PInvoke/vb/Example1.vb#1)] + [!code-cpp[Conceptual.Interop.PInvoke#1](../../../samples/snippets/cpp/VS_Snippets_CLR/Conceptual.Interop.PInvoke/cpp/Example.cpp#1)] + [!code-csharp[Conceptual.Interop.PInvoke#1](../../../samples/snippets/csharp/VS_Snippets_CLR/Conceptual.Interop.PInvoke/cs/Example1.cs#1)] + [!code-vb[Conceptual.Interop.PInvoke#1](../../../samples/snippets/visualbasic/VS_Snippets_CLR/Conceptual.Interop.PInvoke/vb/Example1.vb#1)] For additional examples, see [Marshaling Data with Platform Invoke](../../../docs/framework/interop/marshaling-data-with-platform-invoke.md). diff --git a/docs/framework/wcf/creating-ws-i-basic-profile-1-1-interoperable-services.md b/docs/framework/wcf/creating-ws-i-basic-profile-1-1-interoperable-services.md index 53a67bdcaef7e..7ac348c6c46ea 100644 --- a/docs/framework/wcf/creating-ws-i-basic-profile-1-1-interoperable-services.md +++ b/docs/framework/wcf/creating-ws-i-basic-profile-1-1-interoperable-services.md @@ -37,13 +37,12 @@ To configure a [!INCLUDE[indigo2](../../../includes/indigo2-md.md)] service endp ## Example ### Description - The following example code demonstrates how to add a [!INCLUDE[indigo2](../../../includes/indigo2-md.md)] endpoint that is compatible with [!INCLUDE[vstecasp](../../../includes/vstecasp-md.md)] Web service clients in code and, alternatively, in configuration files. + The following example code demonstrates how to add a [!INCLUDE[indigo2](../../../includes/indigo2-md.md)] endpoint that is compatible with [!INCLUDE[vstecasp](../../../includes/vstecasp-md.md)] Web service clients in code and, alternatively, in a configuration file. ### Code [!code-csharp[C_HowTo-WCFServiceAndASMXClient#0](../../../samples/snippets/csharp/VS_Snippets_CFX/c_howto-wcfserviceandasmxclient/cs/program.cs#0)] - [!code-vb[C_HowTo-WCFServiceAndASMXClient#0](../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_howto-wcfserviceandasmxclient/vb/program.vb#0)] - - + [!code-vb[C_HowTo-WCFServiceAndASMXClient#0](../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_howto-wcfserviceandasmxclient/vb/program.vb#0)] + ## See Also [Interoperability with ASP.NET Web Services](../../../docs/framework/wcf/feature-details/interop-with-aspnet-web-services.md) \ No newline at end of file diff --git a/docs/framework/wcf/extending/how-to-create-a-custom-claim.md b/docs/framework/wcf/extending/how-to-create-a-custom-claim.md index 8e2ae5ad7d605..c0b451f93bcda 100644 --- a/docs/framework/wcf/extending/how-to-create-a-custom-claim.md +++ b/docs/framework/wcf/extending/how-to-create-a-custom-claim.md @@ -57,8 +57,8 @@ The Identity Model infrastructure in [!INCLUDE[indigo1](../../../../includes/ind The following code example defines a custom resource type named `MyResourceType`. - [!code-csharp[c_CustomClaim#2](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_customclaim/cs/c_customclaim.cs#2)] - + [!code-csharp[c_CustomClaim#2](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_customclaim/cs/c_customclaim.cs#2)] + [!code-vb[c_CustomClaim#2](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_customclaim/vb/c_customclaim.vb#2)] 3. Choose a right that is defined by [!INCLUDE[indigo2](../../../../includes/indigo2-md.md)] or a unique value for a custom right. @@ -68,8 +68,8 @@ The Identity Model infrastructure in [!INCLUDE[indigo1](../../../../includes/ind The following code example creates a custom claim with a claim type of `http://example.org/claims/complexcustomclaim`, a custom resource type of `MyResourceType`, and with the right. - [!code-csharp[c_CustomClaim#5](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_customclaim/cs/c_customclaim.cs#5)] - + [!code-csharp[c_CustomClaim#5](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_customclaim/cs/c_customclaim.cs#5)] + [!code-vb[c_CustomClaim#5](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_customclaim/vb/c_customclaim.vb#5)] ## Example The following code example demonstrates how to create a custom claim with a primitive resource type and a custom claim with a non-primitive resource type. diff --git a/docs/framework/wcf/extending/how-to-import-custom-policy-assertions.md b/docs/framework/wcf/extending/how-to-import-custom-policy-assertions.md index 34eccaadc39f5..5e615ae4029f1 100644 --- a/docs/framework/wcf/extending/how-to-import-custom-policy-assertions.md +++ b/docs/framework/wcf/extending/how-to-import-custom-policy-assertions.md @@ -49,9 +49,7 @@ Policy assertions describe the capabilities and requirements of a service endpoi 1. Add the importer type to the `` element inside the [\](../../../../docs/framework/configure-apps/file-schema/wcf/policyimporters.md) element in the client configuration file. - - - + 2. In the client application, use the or to resolve the metadata and the importer is invoked automatically. diff --git a/docs/framework/wcf/extending/how-to-inspect-and-modify-messages-on-the-service.md b/docs/framework/wcf/extending/how-to-inspect-and-modify-messages-on-the-service.md index a5397e95ee896..5250299c5ed4b 100644 --- a/docs/framework/wcf/extending/how-to-inspect-and-modify-messages-on-the-service.md +++ b/docs/framework/wcf/extending/how-to-inspect-and-modify-messages-on-the-service.md @@ -41,9 +41,7 @@ You can inspect or modify the incoming or outgoing messages across a [!INCLUDE[i [!code-csharp[Interceptors#8](../../../../samples/snippets/csharp/VS_Snippets_CFX/interceptors/cs/insertingbehaviors.cs#8)] [!code-vb[Interceptors#8](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/interceptors/vb/insertingbehaviors.vb#8)] - - - + ## See Also diff --git a/docs/framework/wcf/extending/how-to-inspect-or-modify-parameters.md b/docs/framework/wcf/extending/how-to-inspect-or-modify-parameters.md index ca7f27b9fa967..93e717e6da79e 100644 --- a/docs/framework/wcf/extending/how-to-inspect-or-modify-parameters.md +++ b/docs/framework/wcf/extending/how-to-inspect-or-modify-parameters.md @@ -41,9 +41,7 @@ You can inspect or modify the incoming or outgoing messages for a single operati [!code-csharp[Interceptors#5](../../../../samples/snippets/csharp/VS_Snippets_CFX/interceptors/cs/insertingbehaviors.cs#5)] [!code-vb[Interceptors#5](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/interceptors/vb/insertingbehaviors.vb#5)] - - - + ## See Also [Configuring and Extending the Runtime with Behaviors](../../../../docs/framework/wcf/extending/configuring-and-extending-the-runtime-with-behaviors.md) \ No newline at end of file diff --git a/docs/framework/wcf/feature-details/cert-val-diff-https-ssl-over-tcp-and-soap.md b/docs/framework/wcf/feature-details/cert-val-diff-https-ssl-over-tcp-and-soap.md index f7180a7ccb405..a9056ea9fa706 100644 --- a/docs/framework/wcf/feature-details/cert-val-diff-https-ssl-over-tcp-and-soap.md +++ b/docs/framework/wcf/feature-details/cert-val-diff-https-ssl-over-tcp-and-soap.md @@ -26,8 +26,8 @@ You can use certificates in [!INCLUDE[indigo1](../../../../includes/indigo1-md.m ## Validation of HTTPS Service Certificates When using HTTPS to communicate between a client and a service, the certificate that the server authenticates with must support chain trust by default. That is, it must chain to a trusted root certificate authority. No online check is performed to see whether the certificate has been revoked. You can override this behavior by registering a callback, as shown in the following code. - [!code-csharp[c_CertificateValidationDifferences#1](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_certificatevalidationdifferences/cs/source.cs#1)] - + [!code-csharp[c_CertificateValidationDifferences#1](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_certificatevalidationdifferences/cs/source.cs#1)] + [!code-vb[c_CertificateValidationDifferences#1](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_certificatevalidationdifferences/vb/source.vb#1)] where the signature for `ValidateServerCertificate` is as follows: diff --git a/docs/framework/wcf/feature-details/config-wcf-service-with-aspnet-web-service.md b/docs/framework/wcf/feature-details/config-wcf-service-with-aspnet-web-service.md index b1ff4e4957c3c..4cf193c04be53 100644 --- a/docs/framework/wcf/feature-details/config-wcf-service-with-aspnet-web-service.md +++ b/docs/framework/wcf/feature-details/config-wcf-service-with-aspnet-web-service.md @@ -45,10 +45,9 @@ To configure a [!INCLUDE[indigo1](../../../../includes/indigo1-md.md)] service e ## Example The following example code demonstrates how to add a [!INCLUDE[indigo2](../../../../includes/indigo2-md.md)] endpoint that is compatible with [!INCLUDE[vstecasp](../../../../includes/vstecasp-md.md)] Web service clients in code and alternatively in configuration files. - [!code-csharp[C_HowTo-WCFServiceAndASMXClient#0](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_howto-wcfserviceandasmxclient/cs/program.cs#0)] - [!code-vb[C_HowTo-WCFServiceAndASMXClient#0](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_howto-wcfserviceandasmxclient/vb/program.vb#0)] - - + [!code-csharp[C_HowTo-WCFServiceAndASMXClient#0](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_howto-wcfserviceandasmxclient/cs/program.cs#0)] + [!code-vb[C_HowTo-WCFServiceAndASMXClient#0](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_howto-wcfserviceandasmxclient/vb/program.vb#0)] + ## See Also [How to: Create a Service Endpoint in Code](../../../../docs/framework/wcf/feature-details/how-to-create-a-service-endpoint-in-code.md) diff --git a/docs/framework/wcf/feature-details/create-a-service-arbitrary-data-using-wcf.md b/docs/framework/wcf/feature-details/create-a-service-arbitrary-data-using-wcf.md index 3a8ac76939d29..b11c7c7ee0aee 100644 --- a/docs/framework/wcf/feature-details/create-a-service-arbitrary-data-using-wcf.md +++ b/docs/framework/wcf/feature-details/create-a-service-arbitrary-data-using-wcf.md @@ -199,8 +199,6 @@ namespace ReceiveRawData ``` - - ## Compiling the Code - When compiling the code reference System.ServiceModel.dll and System.ServiceModel.Web.dll diff --git a/docs/framework/wcf/feature-details/create-an-ajax-wcf-asp-net-client.md b/docs/framework/wcf/feature-details/create-an-ajax-wcf-asp-net-client.md index ec383bb31c776..77c44ed133874 100644 --- a/docs/framework/wcf/feature-details/create-an-ajax-wcf-asp-net-client.md +++ b/docs/framework/wcf/feature-details/create-an-ajax-wcf-asp-net-client.md @@ -175,6 +175,4 @@ alert(result); -``` - - \ No newline at end of file +``` diff --git a/docs/framework/wcf/feature-details/how-to-create-a-service-that-requires-sessions.md b/docs/framework/wcf/feature-details/how-to-create-a-service-that-requires-sessions.md index 8a2d6fa81c398..bc825c3237fc0 100644 --- a/docs/framework/wcf/feature-details/how-to-create-a-service-that-requires-sessions.md +++ b/docs/framework/wcf/feature-details/how-to-create-a-service-that-requires-sessions.md @@ -32,19 +32,15 @@ Sessions create a shared state between two or more endpoints that enables useful 3. Configure your service endpoint to use a binding that supports sessions. The following configuration example shows the use of the , which supports a WS`-`ReliableMessaging session. - - - + + ## Example The following example code shows how to specify a contract-level session requirement and use a configuration file to support that requirement with the binding. - [!code-csharp[SCA.Session#1](../../../../samples/snippets/csharp/VS_Snippets_CFX/sca.session/cs/services.cs#1)] - [!code-vb[SCA.Session#1](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/sca.session/vb/services.vb#1)] - - - - + [!code-csharp[SCA.Session#1](../../../../samples/snippets/csharp/VS_Snippets_CFX/sca.session/cs/services.cs#1)] + [!code-vb[SCA.Session#1](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/sca.session/vb/services.vb#1)] + ## See Also diff --git a/docs/framework/wcf/how-to-host-a-wcf-service-in-a-managed-application.md b/docs/framework/wcf/how-to-host-a-wcf-service-in-a-managed-application.md index 46e07d2ba2a6e..27d2672eeb0c1 100644 --- a/docs/framework/wcf/how-to-host-a-wcf-service-in-a-managed-application.md +++ b/docs/framework/wcf/how-to-host-a-wcf-service-in-a-managed-application.md @@ -63,7 +63,7 @@ To host a service inside a managed application, embed the code for the service i 8. Create an instance of the class, passing a that represents the service type and the base address Uniform Resource Identifier (URI) to the . Enable metadata publishing, and then call the method on the to initialize the service and prepare it to receive messages. [!code-csharp[CFX_SelfHost4#4](../../../samples/snippets/csharp/VS_Snippets_CFX/cfx_selfhost4/cs/program.cs#4)] - + [!code-vb[CFX_SelfHost4#4](../../../samples/snippets/visualbasic/VS_Snippets_CFX/cfx_selfhost4/vb/module1.vb#4)] > [!NOTE] > This example uses default endpoints, and no configuration file is required for this service. If no endpoints are configured, then the runtime creates one endpoint for each base address for each service contract implemented by the service. [!INCLUDE[crabout](../../../includes/crabout-md.md)] default endpoints, see [Simplified Configuration](../../../docs/framework/wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../docs/framework/wcf/samples/simplified-configuration-for-wcf-services.md). diff --git a/docs/framework/wcf/how-to-secure-a-service-with-windows-credentials.md b/docs/framework/wcf/how-to-secure-a-service-with-windows-credentials.md index 3274eab0ef852..5719f590a14b1 100644 --- a/docs/framework/wcf/how-to-secure-a-service-with-windows-credentials.md +++ b/docs/framework/wcf/how-to-secure-a-service-with-windows-credentials.md @@ -77,7 +77,7 @@ This topic shows how to enable transfer security on a [!INCLUDE[indigo1](../../. ##### To use a binding in a client with code -1. Use the SvcUtil.exe tool to generate the proxy code from the service's metadata. [!INCLUDE[crdefault](../../../includes/crdefault-md.md)][How to: Create a Client](../../../docs/framework/wcf/how-to-create-a-wcf-client.md). The generated proxy code inherits from the class, which ensures that every client has the necessary constructors, methods, and properties to communicate with a [!INCLUDE[indigo2](../../../includes/indigo2-md.md)] service. In this example, the generated code includes the `CalculatorClient` class, which implements the `ICalculator` interface, enabling compatibility with the service code. +1. Use the SvcUtil.exe tool to generate the proxy code from the service's metadata. [!INCLUDE[crdefault](../../../includes/crdefault-md.md)] [How to: Create a Client](../../../docs/framework/wcf/how-to-create-a-wcf-client.md). The generated proxy code inherits from the class, which ensures that every client has the necessary constructors, methods, and properties to communicate with a [!INCLUDE[indigo2](../../../includes/indigo2-md.md)] service. In this example, the generated code includes the `CalculatorClient` class, which implements the `ICalculator` interface, enabling compatibility with the service code. 2. This procedure's code is inserted at the beginning of the `Main` method of the client program. @@ -147,8 +147,8 @@ This topic shows how to enable transfer security on a [!INCLUDE[indigo1](../../. ## Example [!code-csharp[c_SecureWindowsService#0](../../../samples/snippets/csharp/VS_Snippets_CFX/c_securewindowsservice/cs/secureservice.cs#0)] - [!code-csharp[c_SecureWindowsClient#0](../../../samples/snippets/csharp/VS_Snippets_CFX/c_securewindowsclient/cs/secureclient.cs#0)] - + [!code-csharp[c_SecureWindowsClient#0](../../../samples/snippets/csharp/VS_Snippets_CFX/c_securewindowsclient/cs/secureclient.cs#0)] + [!code-vb[c_SecureWindowsClient#0](../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_securewindowsclient/vb/secureclient.vb#0)] ## See Also diff --git a/docs/framework/wcf/how-to-specify-a-client-binding-in-configuration.md b/docs/framework/wcf/how-to-specify-a-client-binding-in-configuration.md index 89559137c1e44..e5fdcb4ed7fc1 100644 --- a/docs/framework/wcf/how-to-specify-a-client-binding-in-configuration.md +++ b/docs/framework/wcf/how-to-specify-a-client-binding-in-configuration.md @@ -48,8 +48,8 @@ In this example, a client console application is created to use a calculator ser 4. Svcutil.exe also generates the configuration for the client that uses the class. When using [!INCLUDE[vsprvs](../../../includes/vsprvs-md.md)], name this file App.config. Note that the address and binding information are not specified anywhere inside the implementation of the service. Also, code does not have to be written to retrieve that information from the configuration file. - - + + 5. Create an instance of the `ClientCalculator` in an application, and then call the service operations. [!code-csharp[C_HowTo_ConfigureClientBinding#3](../../../samples/snippets/csharp/VS_Snippets_CFX/c_howto_configureclientbinding/cs/client.cs#3)] diff --git a/docs/framework/wcf/specifying-an-endpoint-address.md b/docs/framework/wcf/specifying-an-endpoint-address.md index 2fd292288b8ed..1970597189ef7 100644 --- a/docs/framework/wcf/specifying-an-endpoint-address.md +++ b/docs/framework/wcf/specifying-an-endpoint-address.md @@ -47,13 +47,13 @@ All communication with a [!INCLUDE[indigo1](../../../includes/indigo1-md.md)] se ## Defining Endpoint Addresses in Configuration To define an endpoint in a configuration file, use the [\](http://msdn.microsoft.com/en-us/13aa23b7-2f08-4add-8dbf-a99f8127c017) element. - + When the method is called (that is, when the hosting application attempts to start the service), the system looks for a [\](../../../docs/framework/configure-apps/file-schema/wcf/service.md) element with a name attribute that specifies "UE.Samples.HelloService". If the [\](../../../docs/framework/configure-apps/file-schema/wcf/service.md) element is found, the system loads the specified class and creates endpoints using the endpoint definitions provided in the configuration file. This mechanism allows you to load and start a service with two lines of code while keeping binding and addressing information out of your code. The advantage of this approach is that these changes can be made without having to recompile or redeploy the application. The optional headers are declared in a [\](../../../docs/framework/configure-apps/file-schema/wcf/headers-element.md). The following is an example of the elements used to specify endpoints for a service in a configuration file that distinguishes between two headers: "Gold" clients from http://tempuri1.org/ and "Standard" clients from http://tempuri2.org/. The client calling this service must have the appropriate [\](../../../docs/framework/configure-apps/file-schema/wcf/headers-element.md) in its configuration file. - + Headers can also be set on individual messages instead of all messages on an endpoint (as shown previously). This is done by using to create a new context in a client application to add a custom header to the outgoing message, as shown in the following example. diff --git a/docs/framework/wcf/specifying-client-run-time-behavior.md b/docs/framework/wcf/specifying-client-run-time-behavior.md index 6c185ce261a44..2d1e92975a174 100644 --- a/docs/framework/wcf/specifying-client-run-time-behavior.md +++ b/docs/framework/wcf/specifying-client-run-time-behavior.md @@ -41,10 +41,8 @@ manager: "erikre" The following code example shows a client configuration file that instructs [!INCLUDE[indigo2](../../../includes/indigo2-md.md)] to return managed exception information from a client callback object in SOAP messages. - - - - + + ## Using the ClientViaBehavior Behavior You can use the behavior to specify the Uniform Resource Identifier for which the transport channel should be created. Use this behavior when the immediate network destination is not the intended processor of the message. This enables multiple-hop conversations when the calling application does not necessarily know the ultimate destination or when the destination `Via` header is not an address. diff --git a/docs/framework/wcf/wcf-client-overview.md b/docs/framework/wcf/wcf-client-overview.md index 92f62076bc706..66e1835a1c2a0 100644 --- a/docs/framework/wcf/wcf-client-overview.md +++ b/docs/framework/wcf/wcf-client-overview.md @@ -80,7 +80,7 @@ svcutil /language:vb /out:ClientCode.vb /config:app.config http://computerName/M For example, a generated configuration file for an `ISampleService` used in the preceding examples contains the following endpoint information. - + This configuration file specifies a target endpoint in the `` element. [!INCLUDE[crabout](../../../includes/crabout-md.md)] using multiple target endpoints, see the or the constructors. diff --git a/docs/framework/winforms/controls/how-to-access-the-managed-html-document-object-model.md b/docs/framework/winforms/controls/how-to-access-the-managed-html-document-object-model.md index ff6f4d1e3f342..31160a0430d5b 100644 --- a/docs/framework/winforms/controls/how-to-access-the-managed-html-document-object-model.md +++ b/docs/framework/winforms/controls/how-to-access-the-managed-html-document-object-model.md @@ -32,9 +32,7 @@ You can access the managed HTML Document Object Model (DOM) from two types of ap 1. Host a control within your Windows Forms application and monitor for the event. For details on hosting controls and monitoring for events, see [Events](../../../../docs/standard/events/index.md). 2. Retrieve the for the current page by accessing the property of the control. - - - + ### To access DOM from a UserControl hosted in Internet Explorer 1. Create your own custom derived class of the class. For more information, see [How to: Author Composite Controls](../../../../docs/framework/winforms/controls/how-to-author-composite-controls.md). diff --git a/docs/framework/wpf/graphics-multimedia/animation-overview.md b/docs/framework/wpf/graphics-multimedia/animation-overview.md index 35e3a6e8fd2f3..f44ce5b3b98cb 100644 --- a/docs/framework/wpf/graphics-multimedia/animation-overview.md +++ b/docs/framework/wpf/graphics-multimedia/animation-overview.md @@ -109,7 +109,7 @@ manager: "wpickett" 1. Create the and add the animation as its child. The following shows how to create the in XAML. - + [!code-xml[animation_ovws2#RectangleOpacityFadeExampleXaml_5](../../../../samples/snippets/csharp/VS_Snippets_Wpf/animation_ovws2/CSharp/Window1.xaml#rectangleopacityfadeexamplexaml_5)] To create the in code, declare a variable at the class level. diff --git a/docs/standard/base-types/how-to-display-localized-date-and-time-information-to-web-users.md b/docs/standard/base-types/how-to-display-localized-date-and-time-information-to-web-users.md index d16c3994b8c5f..c8c2347df4571 100644 --- a/docs/standard/base-types/how-to-display-localized-date-and-time-information-to-web-users.md +++ b/docs/standard/base-types/how-to-display-localized-date-and-time-information-to-web-users.md @@ -81,8 +81,8 @@ Because a Web page can be displayed anywhere in the world, operations that parse ## Example The following example contains both the HTML source and the code for an ASP.NET Web form that asks the user to input a date and time value. A client-side script also writes information on the local date and time of the user's request and the offset of the user's time zone from UTC to a hidden field. This information is then parsed by the server, which returns a Web page that displays the user's input. It also displays the date and time of the user's request using the user's local time, the time on the server, and UTC. - --> - --> + + The client-side script calls the JavaScript `toLocaleString` method. This produces a string that follows the formatting conventions of the user's locale, which is more likely to be successfully parsed on the server. diff --git a/docs/standard/io/how-to-write-text-to-a-file.md b/docs/standard/io/how-to-write-text-to-a-file.md index b4fb341005e5a..42e8f23823f10 100644 --- a/docs/standard/io/how-to-write-text-to-a-file.md +++ b/docs/standard/io/how-to-write-text-to-a-file.md @@ -33,25 +33,25 @@ This topic shows different ways you can write text to a file for .NET Framework ## Example The following example shows how to synchronously write text to a new file using the class, one line at a time. The new text file is saved to the user's My Documents folder. Because the object is declared and instantiated in a `using` statement, the method is invoked which automatically flushes and closes the stream. - --> - --> + [!code-csharp[Conceptual.BasicIO.TextFiles#WriteLine](../../../samples/snippets/csharp/VS_Snippets_CLR/conceptual.basicio.textfiles/cs/source.cs#writeline)] + [!code-vb[Conceptual.BasicIO.TextFiles#WriteLine](../../../samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.basicio.textfiles/vb/source.vb#writeline)] ## Example The following example shows how to append text to an existing file using the class. It uses the same text file from the previous example. - --> - --> + [!code-csharp[Conceptual.BasicIO.TextFiles#AppendText](../../../samples/snippets/csharp/VS_Snippets_CLR/conceptual.basicio.textfiles/cs/source.cs#appendtext)] + [!code-vb[Conceptual.BasicIO.TextFiles#AppendText](../../../samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.basicio.textfiles/vb/source.vb#appendtext)] ## Example The following example shows how to asynchronously write text to a new file using the class. In order to invoke the method, the method call needs to be within an `async` method. The new text file is saved to the user's My Documents folder. - [!code-csharp[Conceptual.BasicIO.TextFiles#WriteAsync](../../../samples/snippets/csharp/VS_Snippets_CLR/conceptual.basicio.textfiles/cs/source.cs#writeasync)] + [!code-csharp[Conceptual.BasicIO.TextFiles#WriteAsync](../../../samples/snippets/csharp/VS_Snippets_CLR/conceptual.basicio.textfiles/cs/source.cs#writeasync)] [!code-vb[Conceptual.BasicIO.TextFiles#WriteAsync](../../../samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.basicio.textfiles/vb/source.vb#writeasync)] ## Example The following example shows how to write text to a new file and append new lines of text to the same file using the class. The and methods open and close the file automatically. If the path you provide to the method already exists, the file will be overwritten. - [!code-csharp[Conceptual.BasicIO.TextFiles#WriteFile](../../../samples/snippets/csharp/VS_Snippets_CLR/conceptual.basicio.textfiles/cs/source.cs#writefile)] + [!code-csharp[Conceptual.BasicIO.TextFiles#WriteFile](../../../samples/snippets/csharp/VS_Snippets_CLR/conceptual.basicio.textfiles/cs/source.cs#writefile)] [!code-vb[Conceptual.BasicIO.TextFiles#WriteFile](../../../samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.basicio.textfiles/vb/source.vb#writefile)] ## Example diff --git a/samples/snippets/cpp/VS_Snippets_CLR/Conceptual.Interop.PInvoke/cpp/Example.cpp b/samples/snippets/cpp/VS_Snippets_CLR/Conceptual.Interop.PInvoke/cpp/Example.cpp index e516dfdfddc6b..82705eff633f2 100644 --- a/samples/snippets/cpp/VS_Snippets_CLR/Conceptual.Interop.PInvoke/cpp/Example.cpp +++ b/samples/snippets/cpp/VS_Snippets_CLR/Conceptual.Interop.PInvoke/cpp/Example.cpp @@ -1,4 +1,4 @@ -// +// using namespace System::Runtime::InteropServices; typedef void* HWND; diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SampleApp.Odbc/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SampleApp.Odbc/CS/source.cs new file mode 100644 index 0000000000000..c70df8af4fdc2 --- /dev/null +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SampleApp.Odbc/CS/source.cs @@ -0,0 +1,58 @@ + +// +using System; +using System.Data; +using System.Data.Odbc; + +class Program +{ + static void Main() + { + // The connection string assumes that the Access + // Northwind.mdb is located in the c:\Data folder. + string connectionString = + "Driver={Microsoft Access Driver (*.mdb)};" + + "Dbq=c:\\Data\\Northwind.mdb;Uid=Admin;Pwd=;"; + + // Provide the query string with a parameter placeholder. + string queryString = + "SELECT ProductID, UnitPrice, ProductName from products " + + "WHERE UnitPrice > ? " + + "ORDER BY UnitPrice DESC;"; + + // Specify the parameter value. + int paramValue = 5; + + // Create and open the connection in a using block. This + // ensures that all resources will be closed and disposed + // when the code exits. + using (OdbcConnection connection = + new OdbcConnection(connectionString)) + { + // Create the Command and Parameter objects. + OdbcCommand command = new OdbcCommand(queryString, connection); + command.Parameters.AddWithValue("@pricePoint", paramValue); + + // Open the connection in a try/catch block. + // Create and execute the DataReader, writing the result + // set to the console window. + try + { + connection.Open(); + OdbcDataReader reader = command.ExecuteReader(); + while (reader.Read()) + { + Console.WriteLine("\t{0}\t{1}\t{2}", + reader[0], reader[1], reader[2]); + } + reader.Close(); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + } + Console.ReadLine(); + } + } +} +// diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.basicio.textfiles/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.basicio.textfiles/cs/source.cs index 03a011f061e6d..ad089a38c979a 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.basicio.textfiles/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.basicio.textfiles/cs/source.cs @@ -44,7 +44,7 @@ static void WriteLineByLine() foreach (string line in lines) outputFile.WriteLine(line); } - // + // } @@ -58,7 +58,7 @@ static void AppendTextSW() using (StreamWriter outputFile = new StreamWriter(mydocpath + @"\WriteLines.txt", true)) { outputFile.WriteLine("Fourth Line"); } - // + // } diff --git a/samples/snippets/csharp/VS_Snippets_Wpf/animation_ovws2/CSharp/Window1.xaml b/samples/snippets/csharp/VS_Snippets_Wpf/animation_ovws2/CSharp/Window1.xaml index f8320a172cc6c..7a967eb0d28c0 100644 --- a/samples/snippets/csharp/VS_Snippets_Wpf/animation_ovws2/CSharp/Window1.xaml +++ b/samples/snippets/csharp/VS_Snippets_Wpf/animation_ovws2/CSharp/Window1.xaml @@ -43,7 +43,7 @@ From="1.0" To="0.0" Duration="0:0:1" AutoReverse="True" RepeatBehavior="Forever" /> - + diff --git a/samples/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks SampleApp.Odbc/VB/source.vb b/samples/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks SampleApp.Odbc/VB/source.vb new file mode 100644 index 0000000000000..9a28c345323fe --- /dev/null +++ b/samples/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks SampleApp.Odbc/VB/source.vb @@ -0,0 +1,57 @@ +' +Option Explicit On +Option Strict On + +Imports System +Imports System.Data +Imports System.Data.Odbc + +Public Class Program + Public Shared Sub Main() + + ' The connection string assumes that the Access + ' Northwind.mdb is located in the c:\Data folder. + Dim connectionString As String = _ + "Driver={Microsoft Access Driver (*.mdb)};" _ + & "Dbq=c:\Data\Northwind.mdb;Uid=Admin;Pwd=;" + + ' Provide the query string with a parameter placeholder. + Dim queryString As String = _ + "SELECT ProductID, UnitPrice, ProductName from Products " _ + & "WHERE UnitPrice > ? " _ + & "ORDER BY UnitPrice DESC;" + + ' Specify the parameter value. + Dim paramValue As Integer = 5 + + ' Create and open the connection in a using block. This + ' ensures that all resources will be closed and disposed + ' when the code exits. + Using connection As New OdbcConnection(connectionString) + + ' Create the Command and Parameter objects. + Dim command As New OdbcCommand(queryString, connection) + command.Parameters.AddWithValue("@pricePoint", paramValue) + + ' Open the connection in a try/catch block. + ' Create and execute the DataReader, writing the result + ' set to the console window. + Try + connection.Open() + Dim dataReader As OdbcDataReader = _ + command.ExecuteReader() + Do While dataReader.Read() + Console.WriteLine( _ + vbTab & "{0}" & vbTab & "{1}" & vbTab & "{2}", _ + dataReader(0), dataReader(1), dataReader(2)) + Loop + dataReader.Close() + + Catch ex As Exception + Console.WriteLine(ex.Message) + End Try + Console.ReadLine() + End Using + End Sub +End Class +' diff --git a/samples/snippets/visualbasic/VS_Snippets_CFX/c_certificatevalidationdifferences/vb/source.vb b/samples/snippets/visualbasic/VS_Snippets_CFX/c_certificatevalidationdifferences/vb/source.vb index bf6abf9dba8b9..394a66263a245 100644 --- a/samples/snippets/visualbasic/VS_Snippets_CFX/c_certificatevalidationdifferences/vb/source.vb +++ b/samples/snippets/visualbasic/VS_Snippets_CFX/c_certificatevalidationdifferences/vb/source.vb @@ -27,7 +27,7 @@ Public Class Test Private Sub Run() ' ServicePointManager.ServerCertificateValidationCallback = New RemoteCertificateValidationCallback(AddressOf ValidateServerCertificate) - ' + ' End Sub ' diff --git a/samples/snippets/visualbasic/VS_Snippets_CFX/c_customclaim/vb/c_customclaim.vb b/samples/snippets/visualbasic/VS_Snippets_CFX/c_customclaim/vb/c_customclaim.vb index d540f1b119f63..96e1ca028f11a 100644 --- a/samples/snippets/visualbasic/VS_Snippets_CFX/c_customclaim/vb/c_customclaim.vb +++ b/samples/snippets/visualbasic/VS_Snippets_CFX/c_customclaim/vb/c_customclaim.vb @@ -1,4 +1,4 @@ - ' +' ' Imports System Imports System.IdentityModel.Claims @@ -49,8 +49,9 @@ NotInheritable Public Class MyResourceType Set Me.number_value = value End Set - End Property ' + End Property End Class 'MyResourceType +' Class Program @@ -59,12 +60,13 @@ Class Program ' ' Create claim with custom claim type and primitive resource Dim c1 As New Claim("http://example.org/claims/simplecustomclaim", "Driver's License", Rights.PossessProperty) - ' + ' ' ' Create claim with custom claim type and structured resource type Dim c2 As New Claim("http://example.org/claims/complexcustomclaim", New MyResourceType("Martin", 38), Rights.PossessProperty) - - End Sub 'Main ' -End Class 'Program ' + ' + ' + End Sub 'Main +End Class 'Program ' Do something with claims ' \ No newline at end of file diff --git a/samples/snippets/visualbasic/VS_Snippets_CFX/c_securewindowsclient/vb/secureclient.vb b/samples/snippets/visualbasic/VS_Snippets_CFX/c_securewindowsclient/vb/secureclient.vb index 56b98cad43551..c285d4ae0dfbe 100644 --- a/samples/snippets/visualbasic/VS_Snippets_CFX/c_securewindowsclient/vb/secureclient.vb +++ b/samples/snippets/visualbasic/VS_Snippets_CFX/c_securewindowsclient/vb/secureclient.vb @@ -103,4 +103,4 @@ Public Class CalculatorClient End Function 'Divide End Class 'CalculatorClient -' \ No newline at end of file +' \ No newline at end of file diff --git a/samples/snippets/visualbasic/VS_Snippets_CFX/cfx_selfhost4/vb/module1.vb b/samples/snippets/visualbasic/VS_Snippets_CFX/cfx_selfhost4/vb/module1.vb index cb07f86feb183..90bce8d59755d 100644 --- a/samples/snippets/visualbasic/VS_Snippets_CFX/cfx_selfhost4/vb/module1.vb +++ b/samples/snippets/visualbasic/VS_Snippets_CFX/cfx_selfhost4/vb/module1.vb @@ -27,7 +27,7 @@ Module Module1 Dim baseAddress As Uri = New Uri("http://localhost:8080/hello") ' - '// + ' ' Create the ServiceHost. Using host As New ServiceHost(GetType(HelloWorldService), baseAddress) diff --git a/samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.basicio.textfiles/vb/source.vb b/samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.basicio.textfiles/vb/source.vb index bed7d965bce8a..587f5f52406b8 100644 --- a/samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.basicio.textfiles/vb/source.vb +++ b/samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.basicio.textfiles/vb/source.vb @@ -43,7 +43,7 @@ Class WriteTextFiles outputFile.WriteLine(line) Next End Using - ' + ' End Sub @@ -57,7 +57,7 @@ Class WriteTextFiles Using outputFile As New StreamWriter(mydocpath & Convert.ToString("\WriteLines.txt"), True) outputFile.WriteLine("Fourth Line") End Using - ' + ' End Sub