Ciao a tutti....

Ho risolto un errore ma ora se ne presenta un altro.
Ora quando arrivo su ExecuteScalar (il parametro behavior da impostare probabilmente nell'oledb non c'è

) ora mi restituisce il seguente "Errore non specificato".
Leggendo lo stack (di cui sotto) e sapendo come si deve comportare il programma (deve cioè ciclare i DataRow ed ottenere il campo immagine direttamente) mi pare di capire che non abbia il tempo di completare l'operazione andando in errore.
Lo stralcio di codice che uso lo metto dopo lo stack.
---------------- INIZIO: STACK --------------------------
SOURCE: Microsoft OLE DB Provider for SQL Server
MESSAGE: Errore non specificato.
STACK: in System.Data.OleDb.OleDbDataReader.ProcessResults(OleDbHResult hr) in System.Data.OleDb.OleDbDataReader.GetRowHandles() in System.Data.OleDb.OleDbDataReader.ReadRowset() in System.Data.OleDb.OleDbDataReader.Read() in System.Data.OleDb.OleDbDataReader.HasRowsRead() in System.Data.OleDb.OleDbDataReader.NextResult() in System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) in System.Data.OleDb.OleDbCommand.ExecuteScalar() in rpPrinting.rpPrintDocument.PrintCustomObjects(Point coord, Object custom, PrintPageEventArgs e, String tablename, rpPrintableTable baseobject) in F:\eCatalog\rpPrinting\clsPrintDocument.vb:riga 2613 in rpPrinting.rpPrintDocument.PrintObjects(Object container, PrintPageEventArgs e, String tablename) in F:\eCatalog\rpPrinting\clsPrintDocument.vb:riga 2272 in rpPrinting.rpPrintDocument.PrintingControl(Object sender, PrintPageEventArgs e) in F:\eCatalog\rpPrinting\clsPrintDocument.vb:riga 1785
---------------- FINE: STACK --------------------------
---------------- INIZIO: CODICE ------------------------
If .ContentType = rpContentType.Immagine Then
If Not .DBDirectAccessKey Is Nothing And String.IsNullOrEmpty(_connstr) = False Then
Dim _dbdaksql As String = "SELECT {0} FROM {1} WHERE {2} = {3}"
_dbdaksql = String.Format(_dbdaksql, .Value, .DBDirectAccessKey.TableName, .DBDirectAccessKey.IDFieldName, Me.DataSource.Tables(tablename).Rows(progrRec).Item(.DBDirectAccessKey.IDFieldName))
If _oleconn.State = ConnectionState.Broken Then
_oleconn.Close()
End If
If _oleconn.State = ConnectionState.Closed Or _oleconn.State = ConnectionState.Broken Then
_oleconn.Open()
End If
Dim _dbdakcmd As New OleDb.OleDbCommand(_dbdaksql, _oleconn)
Dim _dbdakobj As Object
_dbdakobj = _dbdakcmd.ExecuteScalar
Application.DoEvents()
_bytes = CType(_dbdakobj, Byte()).Length
_img = GetImageFromByte(_dbdakobj)
Application.DoEvents()
_dbdakcmd.Dispose()
Application.DoEvents()
GC.Collect()
End If
End If
---------------- FINE: CODICE ------------------------