cu
' Erzeugen einer Connection
' Connectionstring
Dim str_conn As String
str_conn = "Provider=" + Provider + "; Data Source=" + DSN + "; User ID=" + UserID + "; Password=" + Password + ";"
MsgBox "ConnectionString: " + str_conn
Dim conn As New ADODB.Connection
conn.ConnectionString = str_conn
' Öffnen der Verbindung
conn.Open
' Der Command
Dim command As New ADODB.command
Dim dataset As New ADODB.Recordset
command.ActiveConnection = conn
' Wichtige Initialisierungsschritte: Auslesen des Datenbereichs
Dim rowstart As Integer
Dim colstart As Integer
Dim rows As Integer
Dim cols As Integer
Dim table As String
Dim setstr As String
rowstart = range(Split(datenarray, ":")(0)).row
colstart = range(Split(datenarray, ":")(0)).Column
rows = range(Split(datenarray, ":")(1)).row - rowstart + 1
cols = range(Split(datenarray, ":")(1)).Column - colstart + 1
' Initialisieren aller Felder
' Auslesen einer Zeile + Updaten
For rowcount = 1 To rows - 1
command.CommandText = "Select * From Fehlerk.Defectcatalog Where DC_KEY=" + Cells(rowstart + rowcount, colstart + keycolumn - 1).Text
dataset.CursorLocation = adUseClient
dataset.Open command, , adOpenStatic, adLockOptimistic
On Error GoTo stepi --- error, müsste bei dataset.open was schief gegeangen sein!!!
.........
.........
stepi:
Dim strTmp As String
Dim Errs1 As Errors
Set Errs1 = conn.Errors ------------- das klappt nicht!
' Get VB Error Object's information
strTmp = strTmp & vbCrLf & "ADO Error # " & i & ":"
strTmp = strTmp & vbCrLf & " ADO Error # " & Errs1.Number
strTmp = strTmp & vbCrLf & " Description " & Errs1.Description
strTmp = strTmp & vbCrLf & " Source " & Errs1.Source
MsgBox strTmp
dataset.Close