Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,

My actual problem is i wanted to store image and text both in single column field in table 'tblTest'.

Scenario:

I have a following entered data by user:

According to following diagram you can say that this diagram has a more greenery color, and one man is living in this green palace.

test.jpg (assume that you have some image over here)


Explain above diagram.



And now i want to store above enter data in rich text box at database field of table tblTest.

Whether it is possible to store image and text in single column if yes can anybody tell me which data type is suitable for it.
And how to retrieve it again from database.

Thanks,
Posted
Updated 29-Apr-17 3:01am

1 solution

Probably this article on Storing Serialized data to SQL will Help you.

http://aspalliance.com/1093_Serialization_in_Database.a[^]

You could make one class with Image and String and make it [Serializable] and insert this serialized data as performed with article link.

and retrieve and cast that serialized data back to original class.
 
Share this answer
 
Comments
prashant joseph 28-Sep-10 1:57am    
I like this post and very useful to me ... i never thought of serialization....

But the my problem is i want that image and text in same order that user had typed previously.

So in order to do that i think i need to store extra information of positions of images into MyImage object so that i can retrieve it from DB and place back to the original position that user had written. Am i talking right?
Hiren solanki 28-Sep-10 2:00am    
make the class having two properties image,text with get; set; and then apply value to that props. and store this class into DB, in serialized format.
I hope this helped.
Vote or accept answer if it helped.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900