473,624 Members | 2,191 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SQL Image to rich text box

Hi

I am attempting to load data from an ADO recordset (data type = image on SQL
server) into a rich text box. I can save data from the box to the server ok
but I can't display it :@(

I keep getting errors along the line 'cast byte from string not valid'
running

pNoteRTF.Rtf=rs ("noteRTF").Val ue

Any ideas or examples would be much appreciated...

Also, would I be better off storing the rtf as a file as opposed to an image
maybe?

Cheers

Mark
Nov 21 '05 #1
4 2922
In message <oO************ ****@newsfe3-win.ntli.net>, Mark
<ma**@tencdf.co m> writes
Hi

I am attempting to load data from an ADO recordset (data type = image on SQL
server) into a rich text box. I can save data from the box to the server ok
but I can't display it :@(

I keep getting errors along the line 'cast byte from string not valid'
running

pNoteRTF.Rtf=r s("noteRTF").Va lue
Firstly, SQL Server's image data type is defined as adVarLongBinary in
ADO so your code is failing for good reasons. You need to use the
GetChunk / AppendChunk methods of the Fields collection to manipulate
its content.
Also, would I be better off storing the rtf as a file as opposed to an image
maybe?


Depends on your requirements. Personally, I don't like storing files on
any type within a database unless I really have to. If the system is on
a LAN you could store a link to the real file within your database and
then make open the file from that public share.

--
Andrew D. Newbould E-Mail: ne********@NOSP AMzadsoft.com

ZAD Software Systems Web : www.zadsoft.com
Nov 21 '05 #2
Thanks Andrew...

I was hoping to be able to load the rtf's into the database so

1) I could control security (being a bit lazy I am) from within SQL server.
Some of the files need to be protected / hidden etc. and..

2) I wanted to be able to search the files in queries. I understand this is
not possible and have been considering either a) copying the unformatted
text (on save) to the backend (for search purposes) whilst storing the
formatted text in a file (not so clever) or b) programatically doing a
search for files containing specified text and appending these to the list
of records containing specified text (some records hold text in RTF and
others within the record itself).

It's a bit of a pain but I'm tryinging to get seamless results where a
search can cover both table and file data (the files are named
primaryKey.rtf so returning a list of filenames would work).

Thanks again

Mark
Nov 21 '05 #3
In message <ga************ ******@newsfe1-gui.ntli.net>, Mark
<ma**@tencdf.co m> writes
Thanks Andrew...

I was hoping to be able to load the rtf's into the database so

1) I could control security (being a bit lazy I am) from within SQL server.
Some of the files need to be protected / hidden etc. and..

2) I wanted to be able to search the files in queries. I understand this is
not possible and have been considering either a) copying the unformatted
text (on save) to the backend (for search purposes) whilst storing the
formatted text in a file (not so clever) or b) programatically doing a
search for files containing specified text and appending these to the list
of records containing specified text (some records hold text in RTF and
others within the record itself).

It's a bit of a pain but I'm tryinging to get seamless results where a
search can cover both table and file data (the files are named
primaryKey.r tf so returning a list of filenames would work).


If you take the route of storing the unformatted text in the database
then I would suggest changing the data type to TEXT rather than Binary
or Image for storage and access issues (ie: avoiding GetChunk, reducing
index fragmentation, improve performance etc).

Also, it may be wise to put these in a separate link table rather than
the main table. This again would improve storage and you can ignore the
large Text fields when not required (ie: if required use a Select with
an INNER JOIN).

By using a Text field you would also be able to perform selects like
"SELECT * FROM MyTable [optional inner join] WHERE MyTextField LIKE
'%Search String%' ".

Kind Regards,
--
Andrew D. Newbould E-Mail: ne********@NOSP AMzadsoft.com

ZAD Software Systems Web : www.zadsoft.com
Nov 21 '05 #4
Thanks again Andrew... That pretty much may be where I'm heading. Next thing
to tackle is security on the formatted files... I need them to be accessible
only through the application (for non admin users etc.).

Mark
Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3256
by: matt tagliaferri | last post by:
We have remote users running MSDE entering information into a database. To send the data back to the home office, we've written some routines that export the data into SQL Scripts in text files: DELETE <table> where KeyID=<x> INSERT INOT <table> (fields) VALUES (fields). We then zip up these scripts, and either email or ftp the ZIPs back to the home office, where a program opens them up and simply "runs" the SQL statements.
3
3917
by: Ranman | last post by:
Hi all, I have a simple problem that hopefully has a simple solution, but I have yet to figure it out. In a patient database, I have a physician test order form that populates a report that is then printed and mailed out or faxed. It would be nice to have the doc's electronic signature show up on this report, but we have 4 or 5 docs that order tests. So, I would like to use a combo box on this form to select from a
1
7745
by: PC User | last post by:
I found this Rich Text Editor and I've been trying to recreate it in my own application. I've had trouble with the COMCTL.ImageListCtrl and the COMCTL.Toolbar to recreate the toolbar. And I've had trouble with COMCTL.SBarCtrl in recreating the status bar. Does anyone have any experience with these or know of any website that explaines how to use these? http://www.access-programmers.co.uk/forums/attachment.php?attachmentid=5545 ...
3
2687
by: Sachin | last post by:
If I have an image inside the RichTextBox, can I drag/move it inside the RichTextBox with the help of mouse, just like we can move any control on the form during design time. Please guide -- sachin
1
8097
by: Blog the Haggis | last post by:
Hi everyone, The program I am writing has a rich text window showing particular types of data message, and my plan is to insert a small BMP image before each message depending on its type. So far the images are showing up fine, but when you click the image it allows you to resize the BMP to arbitrary dimensions. Is there a way to gain access to the properties of these images at run time
1
16491
by: www.web20developers.com | last post by:
http://www.web20developers.com http://www.web20developers.com/index.php?option=com_content&task=view... Ajallerix : AJAX, simple, fast Web image gallery demo ; at Novell AJAX - microlink pattern tutorial : A microlink is a link that opens up
4
5461
by: Neil | last post by:
Just found out that the Microsoft Rich Textbox does not support full text justification, since it's based on Version 1.0 of the RichEdit Window Class, and full text justification is only available in versions 3.0 or later of the class. However, also just found out that the new Rich Text property in Access 2007 ALSO does not support full text justification! This seems incredible, that MS would create a brand new application, and not...
6
4744
by: David Stone | last post by:
I have a simple question about the alt content of area elements within an image map: is it redundant to include phrases such as "link to..." or "jump to..."? My initial thought is 'yes', since the area element implies a link to some other item or page location, but would like to hear what others think. If it helps at all, the page which prompted me to ask the question is this one: ...
16
11060
by: Neil | last post by:
I posted a few days ago that it seems to me that the Access 2007 rich text feature does not support: a) full text justification; b) programmatic manipulation. I was hoping that someone might know one way or the other whether that was true or not, or could point me to an article or help text that would. What I have seen so far online and in Access 2007 help seems to confirm the above. But that (or at least (b)) seems incredible that it...
0
8234
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8172
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8620
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6110
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4174
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2605
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1784
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1482
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.