Board index » cppbuilder » DBImage "Stream read error" or "Bitmap image is not valid"

DBImage "Stream read error" or "Bitmap image is not valid"

I work with builder 5 and interbase 6.
The DBImage is a blob field.
I've a DBGrid and a DBNavigator on a form.
The grid is readonly and have rowselection.
When i double click the mouse or press enter, a new modal form are created
and executed.
In this modal form there is a DBImage and a DBNavigator.
The datasource are the same, for the two forms.
When i click the button commit in the modal form, sometime work correctly,
sometime appear the error "Stream read error" and the image will not load.
If the first time will work ok, the 2th time i try to load the image, appear
the error "Bitmap image is not valid".
To load the image in the DBImage :
  if(OpenDialog1->Execute())
  {
    TPicture *empty = new TPicture();
    empty->LoadFromFile(OpenDialog1->FileName);
    DBImage1->Picture->Assign(empty);
    delete empty;
  }
  or
  if(OpenDialog1->Execute())
  {
    DBImage->LoadFromFile(OpenDialog1->FileName);
  }

Have any suggestion ?

Thanks in advance

 

Re:DBImage "Stream read error" or "Bitmap image is not valid"


I work with builder 5 and interbase 6.
The DBImage is a blob field.
I've a DBGrid and a DBNavigator on a form.
The grid is readonly and have rowselection.
When i double click the mouse or press enter, a new modal form are created
and executed.
In this modal form there is a DBImage and a DBNavigator.
The datasource are the same, for the two forms.
When i click the button commit in the modal form, sometime work correctly,
sometime appear the error "Stream read error" and the image will not load.
If the first time will work ok, the 2th time i try to load the image, appear
the error "Bitmap image is not valid".
To load the image in the DBImage :
  if(OpenDialog1->Execute())
  {
    TPicture *empty = new TPicture();
    empty->LoadFromFile(OpenDialog1->FileName);
    DBImage1->Picture->Assign(empty);
    delete empty;
  }
  or
  if(OpenDialog1->Execute())
  {
    DBImage->LoadFromFile(OpenDialog1->FileName);
  }

Have any suggestion ?

Thanks in advance

Other Threads