vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
TOP-Angebot: 17 bzw. 24 Entwickler-Vollversionen zum unschlagbaren Preis!  
 vb@rchiv Quick-Search: Suche startenErweiterte Suche starten   Impressum  | Datenschutz  | vb@rchiv CD Vol.6  | Shop Copyright ©2000-2025
 
zurück

 Sie sind aktuell nicht angemeldet.Funktionen: Einloggen  |  Neu registrieren  |  Suchen

VB.NET - Fortgeschrittene
BLOB aus Oracle auslesen funktioniert nicht  
Autor: Supersimsonfahrer
Datum: 06.06.07 16:45

Hallo

ich habe den Code von http://msdn2.microsoft.com/de-de/library/87z0hy49(VS.80).aspx für meine Zwecke abgewandelt, um einen BLOB-Typ aus unserer Oracle-DB ziehen zu können.

aber der Code funktioniert nicht ganz...

        Dim oConn As New OdbcConnection( _
          "DSN=ZDB;Uid=adhrabgleich;Pwd=rzmabgleich")
        Dim cmd As New OdbcCommand
 
        oConn.Open()
        cmd.Connection = oConn
        cmd.CommandText = "SELECT id, datei FROM dateien WHERE id = (SELECT MAX(" & _
          "id) FROM dateien)"
 
        Dim fs As FileStream                 ' Writes the BLOB to a file ( 
        ' *.bmp).
        Dim bw As BinaryWriter               ' Streams the binary data to the 
        ' FileStream object.
 
        Dim bufferSize As Integer = 100      ' The size of the BLOB buffer.
        Dim outbyte(bufferSize - 1) As Byte  ' The BLOB byte() buffer to be 
        ' filled by GetBytes.
        Dim retval As Long                   ' The bytes returned from GetBytes.
        Dim startIndex As Long = 0           ' The starting position in the 
        ' BLOB output.
 
        Dim id As String = ""            ' The publisher id to use in the file 
        ' name.
 
        Dim myReader As OdbcDataReader = cmd.ExecuteReader( _
          CommandBehavior.SequentialAccess)
 
        Do While myReader.Read()
            ' Get the publisher id, which must occur before getting the logo.
            id = myReader.GetString(0)
 
            ' Create a file to hold the output.
            fs = New FileStream("test.exe", FileMode.OpenOrCreate, _
              FileAccess.Write)
            bw = New BinaryWriter(fs)
 
            ' Reset the starting byte for a new BLOB.
            startIndex = 0
 
            ' Read bytes into outbyte() and retain the number of bytes returned.
            retval = myReader.GetBytes(1, startIndex, outbyte, 0, bufferSize)
 
            ' Continue reading and writing while there are bytes beyond the 
            ' size of the buffer.
            Do While retval = bufferSize
                bw.Write(outbyte)
                bw.Flush()
 
                ' Reposition the start index to the end of the last buffer and 
                ' fill the buffer.
                startIndex += bufferSize
                retval = myReader.GetBytes(1, startIndex, outbyte, 0, _
                  bufferSize)
            Loop
 
            ' Write the remaining buffer.
            bw.Write(outbyte, 0, retval - 1)
            bw.Flush()
 
            ' Close the output file.
            bw.Close()
            fs.Close()
        Loop
        ' Close the reader and the connection.
        myReader.Close()
        oConn.Close()
die ID kann ich auslesen, aber...
retval = myReader.GetBytes(1, startIndex, outbyte, 0, bufferSize)
liefert mir nichts zurück...

WARUM???
kennt ihr eine Lösung?

Danke im Vorraus
alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
BLOB aus Oracle auslesen funktioniert nicht 1.539Supersimsonfahrer06.06.07 16:45

Sie sind nicht angemeldet!
Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.

Einloggen  |  Neu registrieren

Funktionen:  Zum Thema  |  GesamtübersichtSuchen 

nach obenzurück
 
   

Copyright ©2000-2025 vb@rchiv Dieter Otter
Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.

Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel