Link to home
Start Free TrialLog in
Avatar of RIAS
RIASFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Parameter for stored procedure

Hello,

I am trying to speed up the execution time for
 Dim param As New SqlParameter()
                param.Direction = ParameterDirection.ReturnValue
                param.ParameterName = "returnValue"

                add to parameter to collection
                 .Parameters.Add(param)


                .CommandType = CommandType.StoredProcedure
                .Connection = MedicalSQL.GetConnection
                .ExecuteNonQuery()

Open in new window

There is sight suggesting using

Public Sub InsertXML(TheXML As String)
    Using objConn As New SqlConnection(DBConnectionString())
        objConn.Open()
        Using objCmd As New SqlCommand("dbo.ProductsAccessXMLInsert")
            objCmd.CommandType = CommandType.StoredProcedure
            objCmd.Connection = objConn
            objCmd.Parameters.Add("ValidXMLInput", SqlDbType.Xml)
            objCmd.Parameters(0).Value = TheXML
 
            objCmd.ExecuteNonQuery()
        End Using
        objConn.Close()
    End Using
End Sub

Open in new window

 

Any suggestions on how can i implement this ?
ASKER CERTIFIED SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RIAS

ASKER

Thanks Andy, just trying and then  will compare the speed
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Huh !   :-(

I did say you need to determine what is taking the time.
Avatar of RIAS

ASKER

Sorry Andy...will split points
Not necessary but please read carefully in future.  (You might get a change in total time by changing things in the VB code, it really depends on how long each bit takes.)