Solved

How to make a ms sql connection faster in vb6

Posted on 2016-11-23
13
48 Views
Last Modified: 2016-11-30
We have a datagrid that it takes time to always load (see code below).  We have the same open in other apps and it's not slow.

Please advice
0
Comment
Question by:rayluvs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
13 Comments
 

Author Comment

by:rayluvs
ID: 41899948
ooops!  (forgot the code)...

 Set cnn = Nothing
 Set rst = Nothing
 Set cnn = New ADODB.Connection
 Set rst = New ADODB.Recordset

 cnn.Open "Provider=SQLOLEDB; " & _
          "Initial Catalog=" & cdb & "; " & _
          "Data Source=" & srvname  & "; " & 
          "integrated security=SSPI; persist security info=True;"

 sSql= "select col1, col2, col3 from TableName"
 dcRecs.ConnectionString = cnn
 dcRecs.RecordSource = sSql
 dcRecs.Refresh

Open in new window

0
 
LVL 48

Expert Comment

by:Martin Liss
ID: 41899952
I don't know if this MS article helps but it's all I can offer.
0
 

Author Comment

by:rayluvs
ID: 41899958
Hi.  We read it but don't know what you want us to look for or anything that points to slow connection.  Can you be more specific?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 29

Expert Comment

by:Pawan Kumar
ID: 41899995
How much time it is taking to connect , > 

How much time your SQL query is taking , >
0
 

Author Comment

by:rayluvs
ID: 41900086
The VB6 code takes around 8 to 12 seconds to load the datagrid window.

Running the same script in MS sql studio takes less than a second.

We have another apps that has the same cnn.Open and it takes 1 second.

(we still checking whats going on... hope u can help)
0
 
LVL 29

Expert Comment

by:Pawan Kumar
ID: 41900093
How many rows are we getting ?

Also are we getting the same exact data in this app and the other apps?
0
 

Author Comment

by:rayluvs
ID: 41900489
Yes, accessing same tables; rows can be 1 or 10000.
0
 
LVL 29

Expert Comment

by:Pawan Kumar
ID: 41901547
Any update this ?
0
 

Accepted Solution

by:
rayluvs earned 0 total points
ID: 41901598
Yes, it es the server name.  We had "(local)" and change it to the actual server name, and it worked fast.

Why is it that if you use "(local)" as a server name it takes longer to connect than when entering the actual "server" name?
0
 
LVL 29

Expert Comment

by:Pawan Kumar
ID: 41901664
Great !!
0
 

Author Comment

by:rayluvs
ID: 41901722
Thanx, but can you explain why using "(local)" as a server name it takes longer to connect than when entering the actual "server" name?
0
 
LVL 29

Assisted Solution

by:Pawan Kumar
Pawan Kumar earned 500 total points
ID: 41901725
If you put local then the System will have to find out the name of the local server out of the servers available. If you directly put the name then this  time will be saved.
0
 

Author Closing Comment

by:rayluvs
ID: 41907013
Thanx!  Selected our entry as the solution since it solved our problem.

Thanx again!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Suggested Courses
Course of the Month3 days, 21 hours left to enroll

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question