fluminis | Bonjour
Code :
- public MemoryStream GetImage(OdbcDataReader resultat, int numeroDuChamp)
- {
- try
- {
- int buffSize = 10000;
- // On teste s'il existe au moins un résultat
- if (resultat != null)
- {
- int startIndex = 0;
- Byte[] byteBLOBData = new Byte[buffSize];
- int read = (int)resultat.GetBytes( numeroDuChamp, startIndex, byteBLOBData, 0, buffSize);
- MemoryStream ms = new MemoryStream(byteBLOBData,true);
- while(read == buffSize)
- {
- //On a rempli totalement le buffer
- //il reste surement encore des choses a lire
- startIndex += buffSize;
- read = (int)resultat.GetBytes( numeroDuChamp, startIndex, byteBLOBData, 0, buffSize);
- //MessageBox.Show(ms.Length.ToString() +" - "+ startIndex.ToString() +" - "+ read.ToString());
- ms.Write(byteBLOBData,0,read);
- }
- return ms;
- }
- }
- catch(Exception ex)
- {
- MessageBox.Show(ex.ToString());
- }
- return null;
- }
|
helas ce charmant bout de code qui fonctionne parfaitement si le champ que je recupere fais moins de bufffSize, dès qu'il entre dans le while (donc il a lu buffSize bits la 1ere fois, me fait un superbe "le flux n'est pas extensible"
Je n'arrive pas a corriger cette erreur.
Auriez vous une idee ?
Merci d'avance |