如何让我的adodc更快地连接到我的SQL Server?

时间:2015-03-21 08:16:02

标签: sql-server vb.net adodb

如何让我的adodc更快地连接到我的SQL Server?在我查看列表视图中的数千条记录之前,花了一分钟(这么久)。请有人帮助我。

我正在使用此代码:

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

0 个答案:

没有答案