Announcement

Collapse
No announcement yet.

Blob in bestehenden DS füllen / funktioniert nicht

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Blob in bestehenden DS füllen / funktioniert nicht

    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

  • #2
    Hallo ctyri,

    damit
    rs.Open "select * from Jobs", conn, adOpenStatic, adLockOptimistic
    wirst Du sehr bald in sehr große Performance-Probleme laufen.
    Auch wenn es Static geöffnet; es macht keinen Sinn einen Cursor mit allen (Blob-) Daten zu öffnen, nur um etwas neue einzufügen. Besser
    rs.Open "select * from Jobs WHERE 1 = 2", conn, adOpenStatic, adLockOptimistic

    .EDIT gibt es bei ADO nicht, wird auch nicht benötigt.
    Du musst nur den Datensatz raussuchen

    rs.Open "select * from Jobs WHERE ID = " & gesuchteID , conn, adOpenStatic, adLockOptimistic
    der Rest geht wie beim Einfügen; spricht

    rs("Download1") = mystream.Read
    rs.Update
    Olaf Helper

    <Blog> <Xing>
    * cogito ergo sum * errare humanum est * quote erat demonstrandum *
    Wenn ich denke, ist das ein Fehler und das beweise ich täglich

    Comment


    • #3
      Hallo,

      erstmal danke für Deine Antwort :-)

      Mit Select * hast Du natürlich Recht.
      Bei dem anderen habe ich allerdings das Problem ich kann esz war ganz normal mit RS("") = "" schreiben und auch mit rs.update aktualisieren aber in meiner MYSQL Tabelle finde ich im Anschluss nichts.

      Comment


      • #4
        finde ich im Anschluss nichts
        Was soll das nun heissen?

        Ist der alte Blob noch vorhanden oder nach dem Update leer (NULL) ?
        Olaf Helper

        <Blog> <Xing>
        * cogito ergo sum * errare humanum est * quote erat demonstrandum *
        Wenn ich denke, ist das ein Fehler und das beweise ich täglich

        Comment

        Working...
        X