473,566 Members | 3,309 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

retrieve image datatype and store it as a file

Hi,

my scenario is like this, I have my document (word.or
excel or pdf) stored a s a binary value(image datatype) in
database, I need it to convert back into thedocument and
save it as the file in my local system,

Is there any way of retrieving the image datatype and
store it as a file in our local system in c#

regards,
Kabin
Nov 16 '05 #1
2 3513
Hi,

I'd introduce an additional column in the data table describing the type of
the binary data stored.
The values in this column would most likely serve as foreign keys into a
dedicated dictionary containing all possible image types.

"kabin selvam" <se*****@knowsy s.net> wrote in message
news:df******** *************** *****@phx.gbl.. .
Hi,

my scenario is like this, I have my document (word.or
excel or pdf) stored a s a binary value(image datatype) in
database, I need it to convert back into thedocument and
save it as the file in my local system,

Is there any way of retrieving the image datatype and
store it as a file in our local system in c#

regards,
Kabin


Nov 16 '05 #2
Hi,

I do have a column named mime type which has the types like
html/word,text/plain etc.

my code is like this

string connstr="server =knowsys-server2;databas e=Argos;uid=sa" ;
string sql="SELECT AttachFilename, Attachment, MimeType FROM
EmailAttachment s WHERE AttachmentID = 7";
SqlConnection connection = new SqlConnection(c onnstr);
SqlCommand command = new SqlCommand(sql, connection);
connection.Open ();
SqlDataReader dr = command.Execute Reader();
System.Byte[] bytPassword = null;
string imgPassward = "";

while(dr.Read() )
{
bytPassword =
(System.Byte[])dr.GetValue(dr .GetOrdinal(("A ttachment")));
}

dr.Close();

imgPassward =
Encoding.ASCII. GetString(bytPa ssword).ToStrin g().Trim();
//string imgPasswa = Convert.ToBase6 4String(bytPass word);
//imgPasswar = (Encoding.UTF8. GetDecoder());
Response.Write( "atlast the string value is " + imgPassward);
but this works for only html\text types , for other types it returns me
an error.

it would be much helpfull if you could help me to solve this retrieving
problem

thanks,
kabin.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #3

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

Similar topics

5
2940
by: Roger Withnell | last post by:
I'm updating a record by opening a recordset, setting the fields and the updating it with objRS.Update. I need to set an image datatype to NULL. objRS("field") = NULL works for datatypes int and varchar but not for datatype image, although there is no error - the image field still contains the image! I'm using SQL server and running an...
7
1742
by: Tom | last post by:
hello friends I want to specify a field to save icons I want to give this field a maximum of 120kb for each icon to be stored in the db. what datatype should I assign to this field and how do I specify the size ? Thanks Tom
2
1618
by: santosh_stb | last post by:
Is there any way of storing an image file into a specific Table . It would be of great help for me if i come to know something about it.
5
10618
by: moondaddy | last post by:
I'm caching a dataset in an asp.net session variable to hold a user's data. one data item I need to store is an image the user uploaded. My problem is that I don't know how to get the image into the dataset because I don't know what datatype to set the dataset column and then set this image to. I saw an example where someone defended a...
5
5880
by: Henrik | last post by:
The problem is (using MS Access 2003) I am unable to retrieve long strings (255 chars) from calculated fields through a recordset. The data takes the trip in three phases: 1. A custom public function returns a long string. This works. 2. A query has a calculated field based on the custom function above. This works when the query is run...
1
13217
by: ahujasatna | last post by:
Hi all!! i am working on C#, ASP.Net with Sql server2000 and i am facing a problem, my Question is: "How to insert and retrieve images to/from Sqlserver2000 Database" I created a table in database there are only two Columns:
3
1970
by: Leong | last post by:
Do you know how to write a code to retrieve the image (DataType) in the mssql? The image file is save in the desktop application, and now i need to do a web to display a image from mssql. Did anyone know that? TQ
1
1335
mafaisal
by: mafaisal | last post by:
Hello Experts I am Using vb.net2005 And sql2005 See The Attachment This is Error When i retrieve image from Db I store Picture as datatype image Please See The Attachment
10
7405
by: Nathan Sokalski | last post by:
I am using ASP.NET 2.0, and need to know how to save and use an image that is stored in an SQL Server image datatype. How can I do this using ASP.NET? Thanks.
0
7673
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...
0
7584
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...
0
7893
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8109
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...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3643
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2085
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
1202
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
926
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...

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.