Solved

SQL Server Connection Slow for VB.NET program

Posted on 2011-09-08
6
455 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
  • 3
  • 2
6 Comments
 
LVL 39

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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 39

Accepted Solution

by:
lcohan earned 500 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 39

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

778 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