Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Mon Jul 13, 2020 10:36 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Save Picture on PostGresql
PostPosted: Thu May 16, 2013 1:07 am 
Offline
User avatar

Joined: Wed Sep 20, 2006 5:12 pm
Posts: 680
Location: Puerto Rico
i have this code but no save the Data is i use a picture to save

Dim imageData as String
Dim bs as BinaryStream
Dim f as FolderItem
Dim db As DatabaseRecord
Dim p as picture = new picture(100, 100, 32)
Dim StrSql As String

db=new DatabaseRecord

db.Column("CntID")="1"
db.Column("Name")=Trim(TxtCompanyname.Text)
db.Column("Dir1")=Trim(TxtDir1Pos.Text)
db.Column("Dir2")=Trim(TxtDir2Pos.Text)
db.Column("City")=Trim(TxtCityPos.Text)
db.Column("State")=Trim(TxtStatePos.Text)
db.Column("ZipCode")=Trim(TxtZipPos.Text)
db.Column("Telephone")=Trim(TxtTelefone.Text)
db.Column("Fax")=Trim(TxtFax.Text)
db.Column("email")=Trim(TxtEmail.Text)
db.Column("Contact")=Trim(TxtContact.Text)
db.Column("Dir1Phy")=Trim(TxtDir1Phy.Text)
db.Column("Dir2Phy")=Trim(TxtDir2Phy.Text)
db.Column("CityPhy")=Trim(TxtCityPhy.Text)
db.Column("StatePhy")=Trim(TxtStatePhy.Text)
db.Column("ZipCodePhy")=Trim(TxtZipPhy.Text)
db.Column("StateTax")=Trim(TxtStateTax.Text)
db.Column("CityTax")=Trim(TxtCityTax.Text)
db.Column("OtherTel")=Trim(TxtOtherTelefone.Text)
db.Column("UserMain")=TxtUserMain.Text
db.Column("UserPass")=TxtUserPass.Text
db.Column("TxtMensage")=TxtMensage.Text
db.Column("Categoria01")=ComboBox1.Text.Trim
db.Column("Categoria02")=ComboBox2.Text.Trim
db.Column("Categoria03")=ComboBox3.Text.Trim
db.Column("Categoria04")=ComboBox4.Text.Trim
db.Column("Categoria05")=ComboBox5.Text.Trim
db.Column("Categoria06")=ComboBox6.Text.Trim

//db.Column("CompanyLogo")

if droppicture<>Nil then
p.graphics.drawpicture droppicture, 0, 0,100, 100, 0, 0, droppicture.width, droppicture.height
end if


If p <> NIL and droppicture <> Nil then //<< == (but hire is empty )
f = SpecialFolder.Temporary.Child( "Temp_Image.jpg" )
//f.saveAsJPEG p
p.Save(f,151)
bs=BinaryStream.Open(f,False)
If bs <> NIL then
imageData = bs.read(bs.length )
bs.close
db.BlobColumn("sPicData") = imageData
End if

If f.exists then
f.delete
End if
End if


DbConn.InsertRecord("CompanyInfo",db)
DbConn.Commit
if DbConn.Error then
MsgBox DbConn.ErrorMessage
DbConn.Rollback
end if

_________________
Thanks for any contribution and God blesses all (I start Using RS in 10/12/2010)
Mac Mini with Lion v10.7.5 and Real Studio 2012r1 Pro And Windows 7 RS2012r1 Personal and Linux RS2012r1 Personal Register user
my Hobbies R/C Turbines Jets Models


Top
 Profile  
Reply with quote  
 Post subject: Re: Save Picture on PostGresql
PostPosted: Thu May 16, 2013 1:16 pm 
Offline

Joined: Mon Aug 14, 2006 9:33 pm
Posts: 1774
Quote:
if droppicture<>Nil then
p.graphics.drawpicture droppicture, 0, 0,100, 100, 0, 0, droppicture.width, droppicture.height
end if

If p <> NIL and droppicture <> Nil then //<< == (but hire is empty )
f = SpecialFolder.Temporary.Child( "Temp_Image.jpg" )
//f.saveAsJPEG p
p.Save(f,151)
bs=BinaryStream.Open(f,False)
If bs <> NIL then
imageData = bs.read(bs.length )
bs.close
db.BlobColumn("sPicData") = imageData
End if

You'll need to clarify why you are saving the picture then reopening it and saving it. It seems to me you should just do:
db.BlobColumn("sPicData") = droppicture
Then you can also show it in a canvas if you want.
p.graphics.drawpicture droppicture, 0, 0,100, 100, 0, 0, droppicture.width, droppicture.height

You can always resize the picture when you get it back from the DB if that is necessary at that time.

_________________
Roger Clary
Class One Software
Educational Software for Lifelong Learning
http://www.classonesoftware.com


Top
 Profile  
Reply with quote  
 Post subject: Re: Save Picture on PostGresql
PostPosted: Thu May 16, 2013 3:03 pm 
Offline
User avatar

Joined: Wed Sep 20, 2006 5:12 pm
Posts: 680
Location: Puerto Rico
My Code works Perfect on REALSQLDATABASE but under PostgreSQLDatabase do no Works and no error msg.
:(

_________________
Thanks for any contribution and God blesses all (I start Using RS in 10/12/2010)
Mac Mini with Lion v10.7.5 and Real Studio 2012r1 Pro And Windows 7 RS2012r1 Personal and Linux RS2012r1 Personal Register user
my Hobbies R/C Turbines Jets Models


Top
 Profile  
Reply with quote  
 Post subject: Re: Save Picture on PostGresql
PostPosted: Thu May 16, 2013 3:33 pm 
Offline
User avatar

Joined: Wed Sep 20, 2006 5:12 pm
Posts: 680
Location: Puerto Rico
I'm frustrated with RS

some works and some no works
:(

_________________
Thanks for any contribution and God blesses all (I start Using RS in 10/12/2010)
Mac Mini with Lion v10.7.5 and Real Studio 2012r1 Pro And Windows 7 RS2012r1 Personal and Linux RS2012r1 Personal Register user
my Hobbies R/C Turbines Jets Models


Top
 Profile  
Reply with quote  
 Post subject: Re: Save Picture on PostGresql
PostPosted: Thu May 16, 2013 3:39 pm 
Offline

Joined: Mon Aug 14, 2006 9:33 pm
Posts: 1774
If you'll answer my question about why you are saving it first and what you are trying to do, I'll try to help. But if you just want to gripe, no one can help you.

_________________
Roger Clary
Class One Software
Educational Software for Lifelong Learning
http://www.classonesoftware.com


Top
 Profile  
Reply with quote  
 Post subject: Re: Save Picture on PostGresql
PostPosted: Thu May 16, 2013 3:54 pm 
Offline
User avatar

Joined: Wed Sep 20, 2006 5:12 pm
Posts: 680
Location: Puerto Rico
sorry
I'm not complaining of any help.

I delete all temporary files on my computer and restart the computer
now show error number 3

:?:

_________________
Thanks for any contribution and God blesses all (I start Using RS in 10/12/2010)
Mac Mini with Lion v10.7.5 and Real Studio 2012r1 Pro And Windows 7 RS2012r1 Personal and Linux RS2012r1 Personal Register user
my Hobbies R/C Turbines Jets Models


Top
 Profile  
Reply with quote  
 Post subject: Re: Save Picture on PostGresql
PostPosted: Thu May 16, 2013 4:23 pm 
Offline
User avatar

Joined: Wed Sep 20, 2006 5:12 pm
Posts: 680
Location: Puerto Rico
Thanks to all this forum

i get it working with this function EncodeHex this was the key

:D

_________________
Thanks for any contribution and God blesses all (I start Using RS in 10/12/2010)
Mac Mini with Lion v10.7.5 and Real Studio 2012r1 Pro And Windows 7 RS2012r1 Personal and Linux RS2012r1 Personal Register user
my Hobbies R/C Turbines Jets Models


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group