請請大家幫我看看(ADO透過odbc存取NOVELL SEVER上的dbf)
為何以下的成式抓一筆資料要5-7秒鐘?
Sub cmdFindRec_Click()
Dim I As Integer
Dim myQry As String
'SQL敘述
myQry = _
" SELECT A1M_ID , A1M_NAME , A1M_ADRS , A1M_AD_A FROM A1D1000M " _
& " WHERE A1M_ID = '" & txtData & "'"
'-------取得資料庫連線----
Set cn = New ADODB.Connection
With cn
.ConnectionString = "DSN=LABOR;timeout=15"
.Open
End With
'--------取得資料集----
If Not Len(txtData.Text) > 0 Then
MsgBox "請輸入事業單位資料"
End If
Set rs = New ADODB.Recordset
rs.Open myQry, cn
If rs.EOF Or rs.BOF Then
MsgBox "找不到資料,請自行輸入!"
For I = 9 To 11
txtInPut(I).BackColor = &H80000005
txtInPut(I) = ""
Next I
Exit Sub
Else
For I = 9 To 11
txtInPut(I).BackColor = &H80000004
Next I
End If
'填入資料
For I = 0 To 2
If IsNull(rs.Fields(I + 1)) Then
txtInPut(I + 9) = " "
Else
txtInPut(I + 9) = rs(I + 1)
End If
Next I
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
End Sub