Execute Parameterized SQL StoredProcedure via ODBC

前端 未结 5 1076
一向
一向 2020-12-10 07:09

From within a C# WinForms app I must execute a parameterized Stored Procedure on a MS SQL Express Server. The Database Connection works, the Procedure works either, but I ge

5条回答
  •  感情败类
    2020-12-10 07:43

    Don't use ODBCConnection to connect to a SQL Server. Use the "normal" SqlConnection, SqlCommand, etc. These are the ones made to work with SQL Server.

    EDIT: Also, you should use the SqlConnectionStringBuilder to assembly the connection string. This is far less error prone than putting the entire connection string into a configuration file or creating it by hand.

提交回复
热议问题