Solved

Parameter for stored procedure

Posted on 2016-09-22
6
54 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

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…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

816 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

8 Experts available now in Live!

Get 1:1 Help Now