passing store procedure for inventry managemnt and maintaining stock table RRS feed

  • Question

  • hii.

    this is my question that i am using sqlbulk and columnmapping for saving data from excel sheet to database..but i need to use a store procedure when i insert datata from excel sheet to Product table then if same product is inserte 2 times then in stock tha total ammount will be increased and number of quantity will be also increased

    so i want to use store procedur for that so plz any one tell me that how i can use that procedure with example....

    Saturday, September 15, 2012 9:42 AM


  • Hi anuj,

    Welcome to the MSDN Forum.

    This issue is a language related issue, please ask it in language forum please. Or you can tell me which language you use, I will help to move it to corresponding forum.

    Anyway, here is an example about how to use Store Procedure in

        Public Sub queryProc(Sql As String)
                'for sql server
                Dim conn As SqlConnection = New SqlConnection()
                conn.ConnectionString = ConnectionString
                'for SQL 
                Dim command1 As SqlCommand = New SqlCommand(Sql, conn)
                command1.CommandType = CommandType.StoredProcedure
                Dim p1 As SqlParameter = New SqlParameter("@Param1", "abc'efd")
                Dim p2 As SqlParameter = New SqlParameter("@Param2", "efghij\@#$%^&")
                Dim p3 As SqlParameter = New SqlParameter()
                p3.ParameterName = "@Param3"
                p3.SqlDbType = SqlDbType.VarChar
                p3.Direction = ParameterDirection.Output
                p3.Size = 60
                Dim p4 As SqlParameter = New SqlParameter()
                p4.ParameterName = "@Param4"
                p4.SqlDbType = SqlDbType.VarChar
                p4.Direction = ParameterDirection.Output
                p4.Size = 60
                command1.Parameters.AddRange({p1, p2, p3, p4})
                Dim r As SqlDataReader = command1.ExecuteReader()
                Dim r2 As SqlDataReader = command1.ExecuteReader()
            Catch ex As Exception
            End Try
        End Sub

    Best regards,

    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, September 17, 2012 10:42 AM