Results 1 to 14 of 14

Thread: [Solved] Slow SQL & DoEvents...

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2005
    Location
    Tijuana,Mexico
    Posts
    109

    Resolved [Solved] Slow SQL & DoEvents...

    Hi!.. I have a question for you guys... but first the data.. I'm working with SQL Server DB, under Windows 2K. The DB has around 5K of records


    I have this SQL statement:

    VB Code:
    1. DoEvents
    2. sql = "SELECT BeOrdenTrabajo.Orden, BeOrdenTrabajo.ID, Rack, (Fecha3TFIn - FechaWO) as TotalTime, BeOrdenTrabajo.Carga, Descarga, " _
    3.    & " (SELECT TOP 1 BeModelos.Modelo FROM BeRequisicion,BeModelos WHERE BeOrdenTrabajo.Orden " _
    4.    & " = BeRequisicion.orden AND BeRequisicion.Modelo = BeModelos.Modelo GROUP BY BeModelos.Modelo) as MyModel, " _
    5.    & " (SELECT TOP 1 BeModelos.TiempoBI FROM BeRequisicion,BeModelos WHERE BeOrdenTrabajo.Orden " _
    6.    & " = BeRequisicion.orden AND BeRequisicion.Modelo = BeModelos.Modelo GROUP BY BeModelos.TiempoBI) as MyBI, " _
    7.    & " (DateAdd(Hour,-(SELECT TOP 1 BeModelos.TiempoBI FROM BeRequisicion,BeModelos WHERE BeOrdenTrabajo.Orden " _
    8.    & " = BeRequisicion.orden AND BeRequisicion.Modelo = BeModelos.Modelo GROUP BY BeModelos.TiempoBI)," _
    9.    & "(Fecha3TFIn - FechaWO))) as Dif FROM BeOrdenTrabajo WHERE  Proceso > 3 ORDER BY Dif DESC"
    10. RSBIData.CursorLocation = adUseClient
    11. RSBIData.Open sql, frmDisplay.eabscn, adOpenStatic, adLockOptimistic

    While doing this process I'm trying to show a blinking label to indicates that the program is doing something (For that I use a timer) so I use a DoEvents just before the SQL.

    What I expected was to have a runnign process, slow process, and a blinking label telling that the program is working even if it looks like is freezed. But what I have is the running process, slow of course, and a freezed label so the program looks like dead... then my questions are:...

    a) Is there a way to improve the speed of the SQL statement (Right now takes around 15-20 seconds to complete)
    b) What can I do to show the make the label "blink" while processing the SQL
    Last edited by G-Hawk; Dec 15th, 2006 at 04:56 PM. Reason: Solved

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width