Solved

Parameter for stored procedure

Posted on 2016-09-22
6
44 Views
Last Modified: 2016-09-29
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 ?
0
Comment
Question by:RIAS
  • 3
  • 2
6 Comments
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 400 total points
ID: 41810585
>>I am trying to speed up the execution time for

Before you can speed things up you need to determine what is taking the time.  Making changes at random will possibly alter the execution speed - but as it is a random change it could even slow it down.
0
 

Author Comment

by:RIAS
ID: 41810589
Thanks Andy, just trying and then  will compare the speed
0
 
LVL 12

Assisted Solution

by:Ramkisan Jagtap
Ramkisan Jagtap earned 100 total points
ID: 41810857
Check the execution time of your stored procedure, it matters more than your vb code.
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 44

Expert Comment

by:AndyAinscow
ID: 41817792
Huh !   :-(

I did say you need to determine what is taking the time.
0
 

Author Comment

by:RIAS
ID: 41817797
Sorry Andy...will split points
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 41817834
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.)
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now