CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2005
    Posts
    76

    I'm using this query via e vb ado. note: -all fields concerned in inner join are in

    I'm using this query via e vb ado.

    note:

    -all fields concerned in inner join are indexed.
    -only that when launching the command via vb code to the query is slow (perhaps 3 or 5 minutes )!!!!!!!

    -if the launch itself on query sql in Sql Server Mangement Express runs in 1 or 2 seconds !!!!!!!!!!!

    -i want to read all records in read mode

    -xxxxx is the ip where the client is installed sql express

    my code is:

    SSQL = "Select * FROM (INNER JOIN BRANCHES ON DATA SPORTELLI.SPORT = DATI.PROVA2)" & _
    "INNER JOIN AREA_TERR ON SPORTELLI.REGIONE = AREA_TERR.COD_AREA ORDER BY AREA_TERR.COD_AREA, DATI.PROVA3"

    CNSQL1.Execute sSQL, adOpenForwardOnly, adLockReadOnly

    Public Sub APRI_CONNESSIONI_SQL1 ()

    On Error GoTo error
    'CNSQL1.CursorLocation = adUseClient
    'CONNECTION TREVIEW
    'Set CNSQL1 = New ADODB.Connection

    CNSQL1.Open "Provider = SQLOLEDB.1; Password = sal21; Persist Security Info = True; User ID = sa; Initial Catalog = DB_ *****; Data Source = xxxxx \ SQLEXPRESS"

    Exit Sub 'exit from the application,
    'benefit would be the next code
    'been executed
    error:
    MsgBox "Error number:" & CStr (Err.Number) 'is used to convert CStr
    'in a string
    MsgBox "Description:" & Err.Description
    MsgBox "source of error:" & Err.Source

    End Sub

    ahhhhhhhhhhhhhh
    add ...
    that if I run the query via Mangement Sql Server Express installed where the application for risiedee sql express has a lightningr, but if I run away Mangement Sql Server Express installed on another computer (always using the same instance and db) the query is very very slow!!!!!!!!!!!!!

    ????????????
    Edit/Delete Message

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: I'm using this query via e vb ado. note: -all fields concerned in inner join ar

    Well, for one, its going thru the REMOTE connection of SQLEXPRESS
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

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

Featured