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
Solved

How to make a ms sql connection faster in vb6

Posted on 2016-11-23
13
41 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
  • 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 46

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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 28

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 28

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 28

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 28

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 28

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

839 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