Jeffery,

Thinks so much as i got to using your example and it did not crash. But when I saved it it did take a sec longer then normal, and when I tried to reviem the saved pic it started to get the pic then locked up my program.

Here is some of my app.

RealSQLDatabase:
// Mind you this is just a short version.
DirectoryDB.SQLExecute "CREATE TABLE Directory (dTradeName VarChar, dGenericName VarChar, dDrug Blob, dNumber Var Char)"

New/Save SQL Data:
rec.JPEGColumn("dDrug") = mdDrug.image

Update SQL Data:
rs.Field("dDrug").JPEGValue = mdDrug.Image

mdListBox:
// This is apart of the ListBox if the cell is clicked it will then show all the data into the editfields.
// NOTE: I have the Picture in an ImageWell, is this right or not?
mdDrug.Image = rs.Field("dDrug").JPEGValue

Now when I rem out the above line [mdDrug.Image = rs.Field("dDrug").JPEGValue] then the program works like normal with no slow downs. Only when I load the pic does that lock up happen. I have 2 pictures that need to be saved in teh database, one for the drug and one for the chemical formula. I am just working on getting one working then I can fix the 2nd one.

Thanks for the example.



----- Original Message ----- From: "Jeffrey Martin" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, October 18, 2006 4:58 PM
Subject: How to save a picture in RealSQLDatabase?


Dear Jonathon:

I suffered to no end trying to find an example that really worked or
way to do this until last week. I hope these examples help you. They
are based on working code, not just made up:

Saving the picture in the database

I have a canvas that gets a picture dragged and dropped on top of it.
That picture gets saved into a picture property called myPic.  I have
the database column (here, thePhoto) defined as a blob. In the
canvas's lostFocus event, I retrieve the record shown on the screen
and update the blob column to contain the picture.

    rs = app.db.SQLSelect("select * from mytable where rowID = " +
cstr(recRowID))
    rs.edit
    rs.field("thePhoto").JPEGValue = myPic  // put the picture
constant into "thePhoto" blob in the database
    rs.update
... error checking
    db.commit
 ... more error checking...

Retrieving the picture from the database

For example, I use this in a listbox and put the picture in a canvas.
The person clicks the product name in the listbox and I retrieve the
picture and other items in the change event.

    rs = app.db.SQLSelect("select rowID,* from mytable where
itemName = 'productName'")  // get the record
    if rs <> nil and rs.RecordCount > 0 then
myPic = rs.field("thePhoto").JPEGValue  // put the blob "thePhoto"
from the database into the picture property myPic
drawNScale(myPic,canvasName) // draw the picture onto a canvas. I
have a method that draws and scales it and writes to the appropriate
canvas.
///
     end if

I hope this helps you. It really is simple to do once you know how.


--------------------------------------------------------------------------------


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


--------------------------------------------------------------------------------


No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.408 / Virus Database: 268.13.5/483 - Release Date: 10/18/2006



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.408 / Virus Database: 268.13.5/483 - Release Date: 10/18/2006

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to