ms 액세스 데이터베이스와 vb 6으로 만든 양식이 포함 된 .MDB 파일을 만듭니다. ms 액세스 2000을 사용 중이며 MDB의 내 로컬 데이터베이스 , 그리고 원격 MS SQL 2005 데이터베이스.ADO에서 연결 및 쿼리에 문제가 발생했습니다.
아래 코드에서 msgbox를 사용하여 결과 집합의 반환 값을 표시 할 수 있지만 텍스트 상자에 출력하려고 시도하면 txtStatus.Value = txtStatus.Value & rstRecordSet.Fields(1) & vbCrLf
과 같이 중단됩니다. 그리고 튜토리얼의 원래 예제에서 보여주는 메소드는 Debug.Print의 메소드를 가지고 있습니다. 그러나 볼 수있는 것은 아무 것도하지 않았습니다. VB는 콘솔 패널을 가지고 있지 않습니다. print 서술문은 어디로 갈까요?
GOT의 에러 코드 :
Function Testing()
On Error GoTo Error_Handling
Dim conConnection As New ADODB.Connection
Dim cmdCommand As New ADODB.Command
Dim rstRecordSet As New ADODB.Recordset
conConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
App.Path & "\" & CurrentDb.Name & ";"
conConnection.CursorLocation = adUseClient
With cmdCommand
.ActiveConnection = conConnection
.CommandText = "SELECT * FROM Opt_In_Customer_Record;"
.CommandType = adCmdText
End With
With rstRecordSet
.CursorType = adOpenStatic
.CursorLocation = adUseClient
.LockType = adLockOptimistic
.Open cmdCommand
End With
If rstRecordSet.EOF = False Then
rstRecordSet.MoveFirst
Do
MsgBox "Record " & rstRecordSet.AbsolutePosition & " " & _
rstRecordSet.Fields(0).Name & "=" & rstRecordSet.Fields(0) & " " & _
rstRecordSet.Fields(1).Name & "=" & rstRecordSet.Fields(1)
rstRecordSet.MoveNext
Loop Until rstRecordSet.EOF = True
End If
conConnection.Close
Set conConnection = Nothing
Set cmdCommand = Nothing
Set rstRecordSet = Nothing
Exit Function
Error_Handling:
MsgBox "Error during function Testing!"
Exit Function
End Function
이 오류를 나열 할 수 있습니다 어느 그것이 발생 '선? – JeffO