Hallo zusammen,
ich habe das sevGrid über einen Recordset mit einer mySQL Datenbank verbunden.
Die Daten aus der Anfragen werden zwar angezeigt, jedoch Checkbox Felder werden als Zahl(0, 1) angezeigt.
Gibt es dan eine Lösung?
Private Sub Form_Load()
' Connection-String festlegen
Dim sServer As String
Dim sUserName As String
Dim sPassword As String
Dim sDBName As String
Dim Conn As ADODB.Connection
Dim strSQL As String
Dim oRs As ADODB.Recordset
Dim i As Long
Dim strTable As String
'Server Hostname (oder IP)
sServer = "localhost"
'Benutzerdaten
sUserName = "root"
sPassword = "PW"
'Datenbank-Name
sDBName = "test"
' Instanzierung des Objekts
Set Conn = New ADODB.Connection
Conn.Provider = "MSDASQL"
Conn.Mode = adModeReadWrite
Conn.CursorLocation = adUseClient
Conn.Open "DRIVER={MySQL ODBC 3.51 Driver};" & "DATABASE=" + sDBName + ";" _
& "SERVER=" + sServer + ";", sUserName, sPassword
strTable = "Tabelle4"
Conn.Execute "INSERT INTO " + strTable + "(Feld2, Feld3, Feld4, Feld5," & _
"Feld6, Feld7, Feld8, Feld9, Feld10, Feld11) VALUES(1,'Text mit" & _
"Muss-Eintrag','Text ohne Muss-Eintrag','" + Format(Now, "YYYY:MM:DD" & _
"hh:mm:ss") + "',False,'Langtext',1.001,'Text',100.1,256.97)", , _
adExecuteNoRecords
Conn.Execute "INSERT INTO " + strTable + "(Feld2, Feld3, Feld4, Feld5," & _
"Feld6, Feld7, Feld8, Feld9, Feld10, Feld11) VALUES(1,'Text mit" & _
"Muss-Eintrag','Text ohne Muss-Eintrag','" + Format(Now, "YYYY:MM:DD" & _
"hh:mm:ss") + "',False,'Langtext',1.001,'Text',100.1,256.97)", , _
adExecuteNoRecords
Conn.Execute "INSERT INTO " + strTable + "(Feld2, Feld3, Feld4, Feld5," & _
"Feld6, Feld7, Feld8, Feld9, Feld10, Feld11) VALUES(1,'Text mit" & _
"Muss-Eintrag','Text ohne Muss-Eintrag','" + Format(Now, "YYYY:MM:DD" & _
"hh:mm:ss") + "',False,'Langtext',1.001,'Text',100.1,256.97)", , _
adExecuteNoRecords
Conn.Execute "INSERT INTO " + strTable + "(Feld2, Feld3, Feld4, Feld5," & _
"Feld6, Feld7, Feld8, Feld9, Feld10, Feld11) VALUES(1,'Text mit" & _
"Muss-Eintrag','Text ohne Muss-Eintrag','" + Format(Now, "YYYY:MM:DD" & _
"hh:mm:ss") + "',False,'Langtext',1.001,'Text',100.1,256.97)", , _
adExecuteNoRecords
Conn.Execute "INSERT INTO " + strTable + "(Feld2, Feld3, Feld4, Feld5," & _
"Feld6, Feld7, Feld8, Feld9, Feld10, Feld11) VALUES(1,'Text mit" & _
"Muss-Eintrag','Text ohne Muss-Eintrag','" + Format(Now, "YYYY:MM:DD" & _
"hh:mm:ss") + "',False,'Langtext',1.001,'Text',100.1,256.97)", , _
adExecuteNoRecords
Conn.Execute "INSERT INTO " + strTable + "(Feld2, Feld3, Feld4, Feld5," & _
"Feld6, Feld7, Feld8, Feld9, Feld10, Feld11) VALUES(1,'Text mit" & _
"Muss-Eintrag','Text ohne Muss-Eintrag','" + Format(Now, "YYYY:MM:DD" & _
"hh:mm:ss") + "',False,'Langtext',1.001,'Text',100.1,256.97)", , _
adExecuteNoRecords
Conn.Execute "INSERT INTO " + strTable + "(Feld2, Feld3, Feld4, Feld5," & _
"Feld6, Feld7, Feld8, Feld9, Feld10, Feld11) VALUES(1,'Text mit" & _
"Muss-Eintrag','Text ohne Muss-Eintrag','" + Format(Now, "YYYY:MM:DD" & _
"hh:mm:ss") + "',False,'Langtext',1.001,'Text',100.1,256.97)", , _
adExecuteNoRecords
Conn.Execute "INSERT INTO " + strTable + "(Feld2, Feld3, Feld4, Feld5," & _
"Feld6, Feld7, Feld8, Feld9, Feld10, Feld11) VALUES(1,'Text mit" & _
"Muss-Eintrag','Text ohne Muss-Eintrag','" + Format(Now, "YYYY:MM:DD" & _
"hh:mm:ss") + "',False,'Langtext',1.001,'Text',100.1,256.97)", , _
adExecuteNoRecords
Conn.Execute "INSERT INTO " + strTable + "(Feld2, Feld3, Feld4, Feld5," & _
"Feld6, Feld7, Feld8, Feld9, Feld10, Feld11) VALUES(1,'Text mit" & _
"Muss-Eintrag','Text ohne Muss-Eintrag','" + Format(Now, "YYYY:MM:DD" & _
"hh:mm:ss") + "',False,'Langtext',1.001,'Text',100.1,256.97)", , _
adExecuteNoRecords
Set oRs = New ADODB.Recordset
oRs.Open "SELECT * FROM " + strTable, Conn, adOpenStatic, adLockReadOnly
With sevGrid1
.LockUpdate True
Set .Recordset = oRs
.CheckBoxStyle = CHECKBOX_XP
.LockUpdate False
.Refresh
End With
End Sub |