Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6845881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:33:18+00:00 2026-05-27T00:33:18+00:00

I have the code below running in my application and it takes approx 2

  • 0

I have the code below running in my application and it takes approx 2 – 6 seconds to run, on average it is around 3-4 seconds. I know that the stored procedure executes way under a second so the problem must be with my VB.Net code. Is there anything I can do to this to improve performance at all?

So far I have sped it up slightly by making my stored proc return some of the HTML ready to be inserted into each element rather than having multiple IF statements within the loop, and I changed the loop to a While rather than for each which has helped slightly. I am assuming that some of the performance problems may be down to the server but I would also like to know if there is anything in my code that could be improved.

Thanks

   Private Sub dbGetOpenUnassignedTickets()

      ' Here we need to get the results of the query
      Dim Events As New DataTable()

      Dim conn As New SqlConnection(ConfigurationManager.ConnectionStrings("Blueprint").ToString())

      Dim cmd As New SqlCommand
      cmd.CommandType = CommandType.StoredProcedure
      cmd.CommandText = "spGetUnassignedTickets"

      cmd.Connection = conn

      Using da As New SqlDataAdapter(cmd)
         conn.Open()
         da.Fill(Events)
         conn.Close()
      End Using

      Dim TicketHTML As String = String.Empty
      Dim counter As Integer = 0
      While (counter < Events.Rows.Count - 1)

         Dim strDragDrop As String

         strDragDrop = "onmousedown='return DayPilotCalendar.dragStart(this.parentNode, 60*30, """ & Events.Rows(counter)("TicketID") & """, ""EE"");'"

         'IF Current user <> looking at their own schedule AND not allowed to assign tickets
         If (Session("UserID") <> ddlUser.SelectedValue And Session("AssignTickets") = 0) Then
            strDragDrop = String.Empty
         End If

         TicketHTML = TicketHTML + Events.Rows(counter)("SeverityHTML")

         TicketHTML = TicketHTML + "<table width='100%' " + strDragDrop + ">"

         TicketHTML = TicketHTML + Events.Rows(counter)("TypeHTML")

         TicketHTML = TicketHTML + Events.Rows(counter)("ProductHTML")

         TicketHTML = TicketHTML + "<tr>"
         TicketHTML = TicketHTML + "<td colspan='2'><b>Description</b> <br />" + Events.Rows(counter)("DescriptionHTML") + "</td>"

         TicketHTML = TicketHTML + "</tr>"

         TicketHTML = TicketHTML + "<tr>"
         TicketHTML = TicketHTML + "<td>"
         TicketHTML = TicketHTML + "<b>Logged Date:</b>"
         TicketHTML = TicketHTML + "</td>"
         TicketHTML = TicketHTML + "<td align='left'>"
         TicketHTML = TicketHTML + Events.Rows(counter)("LogDate")
         TicketHTML = TicketHTML + "</td>"
         TicketHTML = TicketHTML + "</tr>"

         TicketHTML = TicketHTML + "</table>"
         TicketHTML = TicketHTML + "</div>"

         counter = counter + 1

      End While

      ' And now update the inner HTML of the thing we are putting the tickets into
      divTickets.InnerHtml = TicketHTML

   End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:33:19+00:00Added an answer on May 27, 2026 at 12:33 am

    I recommend you use SqlDataReader for data retrieval and StringBuilder for building your HTML.

    You can also alter or make a new version of spGetUnassignedTickets that only return the columns needed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the code below that hides and shows the navigational bar. It is
Summary I have written a process monitor command-line application that takes as parameters: The
I just have the below code that was provides as hMailServer's DCOM API at
Below, I have written simple code that re-creates problems that have emerged as my
I have an application that will only stop/start services if it is run as
I have code below: <select id=testSelect> <option value=1>One</option> <option value=2>Two</option> </select> <asp:Button ID=btnTest runat=server
I have the code below : public class Anything { public int Data {
I have to code below - works great in IE and Opera, but does
I have the code below with 3 columns. I want to have the border
I have the code below in my test code in many places: // //

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.