0

How can I make my adodc connect faster to my SQL Server? It's taking a minute (so long) before I can view thousand of record in my listview. Please anyone help me.

I'm using this code:

Public Class McheckpaymentNew

Private cn As New ADODB.Connection
Private rs As New ADODB.Recordset

Private Sub McheckpaymentNew_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    Try

        cn.ConnectionString = "DSN=database; UID=user; PWD=password"
        cn.Open()

        rs.CursorLocation = ADODB.CursorLocationEnum.adUseClient
        rs.CursorType = ADODB.CursorTypeEnum.adOpenStatic
        rs.LockType = ADODB.LockTypeEnum.adLockBatchOptimistic

    Catch ex As Exception
        MsgBox("Failed to Connect!, Please check your Network Connections, or Contact MIS Dept. for assistance.", vbCritical, "Error while Connecting to Database.."
        End
    End Try

End Sub
End Class
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • Why do you think the problem is in this code? Did you measure it? Or is it the listview filling that takes so long? – Steve Mar 21 '15 at 08:22
  • So what do you think the problem was?..can you help me?..its not just the list view, also combobox, every time i connect to the sql server its taking a while before its display the records, but if the record is not that many its display faster, but if the record that i want to display is thousand and more its so slow.. – Eon Rosales Rodil Mar 23 '15 at 01:25
  • It is not possible to say with absolute certainty because I don't know your requisites, but, usually, if you have thousands of records It is not acceptable to show them all together in the same user interface element. Perhaps you should look at your problem with a different angle. Try to Implement something like a search box and a button and show only a subset of the records. – Steve Mar 23 '15 at 11:42

0 Answers0