DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2007
    Posts
    15

    Post how to make faster execution time for vb

    Hi everyone,

    I have an interface (a form using visual basic code) to execute sql statement to update the database access 2007 on sql server. The interface takes a long time to execute the sql statement. Does anyone has any idea how to speed up the run time execution for vb? Thanks in advance

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Difficult to say without seeing your code. Please post your SQL query and the code you're using to execute it.
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Jul 2007
    Posts
    15
    Here is my code:

    Private Sub cmdResetNotSelectedCustomer_Click()

    If dropdown.ItemData(dropdown.ListIndex) <> vbNullString Then
    Dim selectCustomer As String
    selectCustomer = CStr(dropdown.ItemData(dropdown.ListIndex))
    If msgbox("Do you want to RESET all Customers except " & selectCustomer & "?", vbYesNo + vbQuestion, "Reset Customer") = vbYes Then
    Dim strSQL As String
    strSQL = "UPDATE Main SET Downloaded = 0, Errors_Fail = 0, Error_Code = '', Time_Updated = '' WHERE Enabled = Yes And Customer <> '" & selectCustomer & "'"
    CurrentDb.Execute (strSQL)
    End If
    Else
    msgbox "Please select a Customer", vbInformation, "Select Customer"
    End If

    End Sub

  4. #4
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Do you have indexes on your Enabled and Customer columns? If not, try adding them; that should speed up your query execution.
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  5. #5
    Join Date
    Jul 2007
    Posts
    15
    Phil, How can I add index in Enabled and Customer? Can you show me a sample of code? Thanks

  6. #6
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    If it's a SQL Server database, see http://www.google.com/search?q=sql+server+create+index . If it's an Access database, see http://www.google.com/search?q=access+create+index .
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

Similar Threads

  1. query tuning
    By dhaya in forum Database
    Replies: 11
    Last Post: 08-25-2003, 05:24 PM
  2. Career based on Microsoft
    By Michael Q. Gautier in forum Careers
    Replies: 28
    Last Post: 07-26-2002, 07:57 PM
  3. Replies: 1
    Last Post: 01-31-2002, 12:13 AM
  4. Need Faster file get name & date routine.
    By Tom Sell in forum authorevents.kurata
    Replies: 1
    Last Post: 04-20-2000, 02:28 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links