Get the parameter prefix in ADO.NET

后端 未结 2 1677
南旧
南旧 2021-02-09 08:30

I want to generate several SQL statements based on a column list using the column names as parameters.

Edit: C#

var columns = new string         


        
2条回答
  •  攒了一身酷
    2021-02-09 08:44

    There are 2 DbCommandBuilder methods that will help you, GetParameterName and GetParameterPlaceholder. These are protected, so you'll need a little reflection to use them.

    Check out my answer to the following question for an implementation (also included in the DbExtensions library):

    What are your favorite extension methods for C#? (codeplex.com/extensionoverflow)

提交回复
热议问题