Hallo Zusammen,
ich versuche bestehenden MYSQL DS über ein Access Frontend über ODBC zu aktualisieren. Konrekt sollen zwei Strings und ein BLOB Wert aktualisiert werden.
Wenn ich einen DS neu erzeuge Funktioniert mein Code wunderbar, aber ich finde keine Möglich keit eine Aktualisierung mit z.b. rs.edit o.ä. kann mir jemand helfen?Public Function Upload(ByVal sFilePath As String, sOriginFieldName As String, Optional FileDescription As String)
Dim driver As String
Dim conn As New ADODB.Connection
Dim sql As String
Dim conf_DB_ConnectionString As String
Dim const_mySQLDriver As String
Dim const_mySQLServer As String
Dim const_mySQLDatabase As String
Dim const_mySQLUser As String
Dim const_mySQLPassword As String
Dim const_mySQLOption As String
'Live
const_mySQLDriver = "{MySQL ODBC 3.51 Driver}"
const_mySQLServer = "xxx.xxx.xxx.xxx"
const_mySQLDatabase = "xxx"
const_mySQLUser = "xxx"
const_mySQLPassword = "xxx"
const_mySQLOption = "16384"
'Live
conf_DB_ConnectionString = "DRIVER=" & const_mySQLDriver & ";" & _
"SERVER=" & const_mySQLServer & ";" & _
"DATABASE=" & const_mySQLDatabase & ";" & _
"USER=" & const_mySQLUser & ";" & _
"PASSWORD=" & const_mySQLPassword & ";" & _
"OPTION=" & const_mySQLOption & ";"
conn.Open conf_DB_ConnectionString
Dim rs As New ADODB.Recordset
Dim mystream As New ADODB.Stream
mystream.Type = adTypeBinary
sql = "SELECT "
Select Case sOriginFieldName
Case "txtUP1"
sql = "* WHERE"
rs.Open "select * from Jobs", conn, adOpenStatic, adLockOptimistic
'rs.Open sql, conn, adOpenDynamic, adLockOptimistic
mystream.Open
mystream.LoadFromFile sFilePath
Select Case sOriginFieldName
Case "txtUP1"
rs("Download1") = mystream.Read
rs("Download1FN") = Form_F_AlleJobs_Details.txtUp1.Value
rs("Download1BN") = FileDescription
end select
rs.Update
mystream.Close
rs.Close
conn.Close
ich versuche bestehenden MYSQL DS über ein Access Frontend über ODBC zu aktualisieren. Konrekt sollen zwei Strings und ein BLOB Wert aktualisiert werden.
Wenn ich einen DS neu erzeuge Funktioniert mein Code wunderbar, aber ich finde keine Möglich keit eine Aktualisierung mit z.b. rs.edit o.ä. kann mir jemand helfen?Public Function Upload(ByVal sFilePath As String, sOriginFieldName As String, Optional FileDescription As String)
Dim driver As String
Dim conn As New ADODB.Connection
Dim sql As String
Dim conf_DB_ConnectionString As String
Dim const_mySQLDriver As String
Dim const_mySQLServer As String
Dim const_mySQLDatabase As String
Dim const_mySQLUser As String
Dim const_mySQLPassword As String
Dim const_mySQLOption As String
'Live
const_mySQLDriver = "{MySQL ODBC 3.51 Driver}"
const_mySQLServer = "xxx.xxx.xxx.xxx"
const_mySQLDatabase = "xxx"
const_mySQLUser = "xxx"
const_mySQLPassword = "xxx"
const_mySQLOption = "16384"
'Live
conf_DB_ConnectionString = "DRIVER=" & const_mySQLDriver & ";" & _
"SERVER=" & const_mySQLServer & ";" & _
"DATABASE=" & const_mySQLDatabase & ";" & _
"USER=" & const_mySQLUser & ";" & _
"PASSWORD=" & const_mySQLPassword & ";" & _
"OPTION=" & const_mySQLOption & ";"
conn.Open conf_DB_ConnectionString
Dim rs As New ADODB.Recordset
Dim mystream As New ADODB.Stream
mystream.Type = adTypeBinary
sql = "SELECT "
Select Case sOriginFieldName
Case "txtUP1"
sql = "* WHERE"
rs.Open "select * from Jobs", conn, adOpenStatic, adLockOptimistic
'rs.Open sql, conn, adOpenDynamic, adLockOptimistic
mystream.Open
mystream.LoadFromFile sFilePath
Select Case sOriginFieldName
Case "txtUP1"
rs("Download1") = mystream.Read
rs("Download1FN") = Form_F_AlleJobs_Details.txtUp1.Value
rs("Download1BN") = FileDescription
end select
rs.Update
mystream.Close
rs.Close
conn.Close
Comment