| |

VB.NET - FortgeschritteneBLOB 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 |  |
 BLOB aus Oracle auslesen funktioniert nicht  | 1.540 | Supersimsonfahrer | 06.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 |
  |
|
sevOutBar 4.0 
Vertikale Menüleisten á la Outlook
Erstellen von Outlook ähnlichen Benutzer- interfaces - mit beliebig vielen Gruppen und Symboleinträgen. Moderner OfficeXP-Style mit Farbverläufen, Balloon-Tips, u.v.m. Weitere InfosTipp des Monats Oktober 2025 Matthias KozlowskiUmlaute konvertierenErsetzt die Umlaute in einer Zeichenkette durch die entsprechenden Doppelbuchstaben (aus ä wird ae, usw.) Access-Tools Vol.1 
Über 400 MByte Inhalt
Mehr als 250 Access-Beispiele, 25 Add-Ins und ActiveX-Komponenten, 16 VB-Projekt inkl. Source, mehr als 320 Tipps & Tricks für Access und VB
Nur 24,95 EURWeitere Infos
|
|
|
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
|
|