Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Thu Nov 23, 2017 9:08 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: storing pdf files in MS SQL SERVER
PostPosted: Thu Apr 18, 2013 10:05 am 
Offline

Joined: Fri Feb 27, 2009 12:18 am
Posts: 54
HI,

does anyone have any examples of code for storing pdf files in a Microsoft Sql Server?

and of course getting them back out again!


Regards,

Russ


Top
 Profile  
Reply with quote  
 Post subject: Re: storing pdf files in MS SQL SERVER
PostPosted: Thu Apr 18, 2013 9:41 pm 
Offline
Site Admin
User avatar

Joined: Fri Sep 30, 2005 9:35 am
Posts: 987
Location: South Portland, Maine
I don't have a specific example, but in general you ought to be able to use a BLOB column for this in conjunction with DatabaseRecord.BlobColumn, DatabaseField.NativeValue. Use a BinaryStream to read the PDF into a string and then write the string to the DB using the BLOB functions.

_________________
Paul Lefebvre
Developer Evangelist
Xojo, Inc.


Top
 Profile  
Reply with quote  
 Post subject: Re: storing pdf files in MS SQL SERVER
PostPosted: Fri Apr 19, 2013 5:35 am 
Offline

Joined: Fri Feb 27, 2009 12:18 am
Posts: 54
thanks paul.


im actually doing this using sqlexecute though rather than databaserecord.


Top
 Profile  
Reply with quote  
 Post subject: Re: storing pdf files in MS SQL SERVER
PostPosted: Fri Apr 19, 2013 2:47 pm 
Offline
Site Admin
User avatar

Joined: Fri Sep 30, 2005 9:35 am
Posts: 987
Location: South Portland, Maine
You ought to also be able to do it with a MSSQLServerPreparedStatement.

Create your SQL using the place holder:

Dim sql As String
sql = "UPDATE table SET blobColumn = ? WHERE ID = ?"

Dim ps As MSSQLPreparedStatement
ps = db.Prepare(sql)


Then bind it:
ps.BindType(0, MSSQLServerPreparedStatement.MSSQLSERVER_TYPE_BINARY)
ps.BindType(1, MSSQLServerPreparedStatement.MSSQLSERVER_TYPE_INT)

ps.Bind(0, blobData)
ps.Bind(1, rowID)


And then you can use SQLExecute:
Dim rs As RecordSet
rs = ps.SQLExecute

_________________
Paul Lefebvre
Developer Evangelist
Xojo, Inc.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 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