Mein Code ist
Dim con As New OleDb.OleDbConnection
Dim dbProvider As String
Dim dbSource As String
dbProvider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;"
dbSource = "Data Source=" & My.Settings.bowlingballdatabase
Dim selectString As String = "Select Picture From BowlingBall WHERE LName = 'Smith'"
Dim oleConnect As New OleDb.OleDbConnection
oleConnect.ConnectionString = dbProvider & dbSource
oleConnect.Open()
Using oleDBCmd As OleDb.OleDbCommand = oleConnect.CreateCommand()
oleDBCmd.CommandType = CommandType.Text
oleDBCmd.CommandText = selectString
Using oleDbReader As OleDb.OleDbDataReader = oleDBCmd.ExecuteReader()
oleDbReader.Read()
Dim ImageBytes As Byte() = CType(oleDbReader(0), Byte())
Dim ms As New MemoryStream(ImageBytes)
Dim img As Image = Image.FromStream(ms)
Me.PictureBox1.Image = img
End Using
End Using
oleConnect.Close()
Ich denke, es könnte ein Problem mit den SQL-Befehlen sein? Ich erhalte den Fehler "Parameter ist ungültig" auf der folgenden Zeile:
Dim img As Image = Image.FromStream(ms)