1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
Imports System.Data.SqlClient Imports System.Data ... Dim con As New SqlConnection Dim cmd As New SqlCommand Try With con .ConnectionString = ConfigurationManager.ConnectionStrings("dbConnectionString").ConnectionString .Open() End With With cmd .Connection = con .CommandText = "StoredProcedureName" .CommandType = CommandType.StoredProcedure .Parameters.Add("@ParamA", SqlDbType.NVarChar, 0).Value = "..." .Parameters.Add("@ParamB", SqlDbType.Int).Value = 1 .ExecuteNonQuery() End With Catch ex As Exception ' обработка ошибок Finally cmd.Dispose() con.Close() End Try |