January 15th, 2009, 04:30 PM
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.
-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
'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
MsgBox "Error number:" & CStr (Err.Number) 'is used to convert CStr
'in a string
MsgBox "Description:" & Err.Description
MsgBox "source of error:" & Err.Source
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!!!!!!!!!!!!!
January 15th, 2009, 10:01 PM
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
Click Here to Expand Forum to Full Width