Solved

Parameter for stored procedure

Posted on 2016-09-22
6
62 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

751 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