Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SQL Server Connection Slow for VB.NET program

Posted on 2011-09-08
6
Medium Priority
?
531 Views
Last Modified: 2012-05-12
I have a program I use to browse records for the sake of approving, rejecting and deleting applicants.

The database is an MS SQL Server 2005 database, in a shared hosting environment.
Our website allows people to register online, but I want the review of applicants to happen inside the program I wrote.

The program works fine - except it's very slow.   Accessing the information online is fast...

I've attached the code I use to do the connection.  When I run this code to select all the records (currently 60), it takes 15-20 seconds to return.

Is there a faster way to connect to a remote sql server database?

Thanks for your help!!!

Thanks for your help!!!


sql = "Select * from myTable"            sqlConn.ConnectionString =  MyConnectionString
            sqlConn.Open()

            'Try
            da = New SqlDataAdapter(sql, sqlConn)
            ds = New DataSet
            da.Fill(ds, "table1")

Open in new window

0
Comment
Question by:slightlyoff
[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
  • 3
  • 2
6 Comments
 
LVL 40

Expert Comment

by:lcohan
ID: 36505414
Did you tested the query directly against your SQL server first to see if is not taking indeed so much to complete in which case optimizations/indexes may be needed.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 36506150
There is a way. Get a faster connection between you computer and the remote server.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 36506159
> but I want the review of applicants to happen inside the program I wrote.

Is that a must? How about a secure page on the website itself as you said the access online is fast?
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 40

Accepted Solution

by:
lcohan earned 2000 total points
ID: 36506214
Did you tried "Select * from myTable" in your SQL?
I have the feeling that's your problem if myTable is huge....no matter what you do to fill in the New DataSet may take some time for large volumes of data.

0
 
LVL 1

Author Closing Comment

by:slightlyoff
ID: 36918242
Thank you!

It's been a while since I was able to get to test this out.  My statments were calling quite a bit.  I simplified them as you suggested and it does appear to speed up a little.

Not perfect, but better than it was.

Thank you for your help!!!
0
 
LVL 40

Expert Comment

by:lcohan
ID: 36918403
You should be able to optimize them even more (unless you get huge data sets in client) by looking at the query plans and add eventual missing indexes. I recomand using SQL performance dashboards and Missing Indexes in particular to boost your SQL performance.

http://www.microsoft.com/download/en/details.aspx?id=22602
http://www.sql-server-performance.com/2007/bm-performance-dashboard-2005/
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

664 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