Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

SQL Server Connection Slow for VB.NET program

Posted on 2011-09-08
6
Medium Priority
?
547 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 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
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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…
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

886 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