All pastes #973460 Raw Edit

Mine

public text v1 · immutable
·published 2008-04-06 03:24 UTC
rendered paste body
Imports System.Data.SqlClient

Friend Class InvoiceDetails
    Public Shared Sub AddInvoiceDetail(ByVal InvoiceNumber As Integer, _
                                       ByVal ProductID As Integer, _
                                       ByVal Quantity As Integer, _
                                       ByVal Price As Integer)

        Dim DBConnection As New SqlConnection(DBConnect)
        Dim myCommand As New SqlCommand("AddInvoiceDetail", DBConnection)

        myCommand.CommandType = CommandType.StoredProcedure

        ' Supply required parameters
        myCommand.Parameters.Add("@InvoiceNumber", SqlDbType.Int).Value = InvoiceNumber
        myCommand.Parameters.Add("@ProductID", SqlDbType.VarChar).Value = ProductID
        myCommand.Parameters.Add("@Quantity", SqlDbType.Int).Value = Quantity
        myCommand.Parameters.Add("@Price", SqlDbType.Decimal).Value = Price

        DBConnection.Open()

        Try
            ' Execute stored procedure and get returned value
            myCommand.ExecuteNonQuery()
        Finally
            DBConnection.Close()
        End Try

    End Sub
End Class