473,407 Members | 2,314 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

File Attachements from database

I have a table with field of type image which has binary data in it.
data could be of image/doc/text/etc type. I need to send this data as
file attachments in emails. I should read the data, store it in some
temp file and then attach that file?

Is there any code?

Thanks

Jan 12 '07 #1
3 1293
Hi,

In the 2.0 framework using the System.Net.Mail.Attachment class (and the
MailMessage class), you can specify string data, a Stream or a file path as
attachments:

Attachment Class
http://msdn2.microsoft.com/en-us/lib...ttachment.aspx

--
Dave Sexton
http://davesexton.com/blog

"Sehboo" <Ma*********@gmail.comwrote in message
news:11**********************@s34g2000cwa.googlegr oups.com...
>I have a table with field of type image which has binary data in it.
data could be of image/doc/text/etc type. I need to send this data as
file attachments in emails. I should read the data, store it in some
temp file and then attach that file?

Is there any code?

Thanks

Jan 13 '07 #2
I have a table with field of type image which has binary data in it.
data could be of image/doc/text/etc type. I need to send this data as
file attachments in emails. I should read the data, store it in some
temp file and then attach that file?
You'll get better performance ( in this scenario and in general ) if
you leave the files in the file system and then just store the paths in
the database. But this info might not help very much after you've
already got things set up...

Jan 13 '07 #3
Hi,

Although that approach doesn't scale well at all. The server and the
database cannot change unless the paths of the new servers remain identical,
load balancing may be difficult and there's more room for error since the
data is just being referenced, not stored. Also, security may be an issue.

Truthfully, I don't know that better performance is attainable simply by
storing the attachments on the file system. Storing them in the database
and using the "string" overload for the Attachment constructor may prove to
be faster since there may be less I/O happening, especially if the code
needs to access the database for other data anyway.

--
Dave Sexton
http://davesexton.com/blog

<Fo**********@gmail.comwrote in message
news:11**********************@51g2000cwl.googlegro ups.com...
>I have a table with field of type image which has binary data in it.
data could be of image/doc/text/etc type. I need to send this data as
file attachments in emails. I should read the data, store it in some
temp file and then attach that file?

You'll get better performance ( in this scenario and in general ) if
you leave the files in the file system and then just store the paths in
the database. But this info might not help very much after you've
already got things set up...

Jan 13 '07 #4

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

Similar topics

5
by: Dave Smithz | last post by:
Hi There, I have a PHP script that sends an email with attachment and works great when provided the path to the file to send. However this file needs to be on the same server as the script. ...
1
by: hanan_cohen | last post by:
Shalom, I am looking for a system that will: 1. Read a message from a POP3 mailbox 2. Parse the message into its parts 3. Create a record in an SQL server table with selected fields of the...
0
by: Fabrice DG | last post by:
Hi all. I don't know if this post is really at the right place but I hope someone can help me.. I developed a NT service, in order to automate mail exchanges between different kind of users This...
4
by: Ryan | last post by:
I am new to web programming and have a need to support file attachments... is there any samples/tutorials on how to do this?
1
by: Seok Bee | last post by:
Dear Experts, I'm trying to open a file from my web form. However, when I click on the button, no action is being performed. I have tried running it in debugging mode, the file is able to open....
4
by: SSUK | last post by:
Hi, Is it better to store files in Database or to store on Hard Disk /network ? On a Web application using .NET...
1
by: Al | last post by:
I'm looking for a sample to save File from clipboard into specified folder on HD. I found many samples for copying text, image etc. But no file copying code so far. Thank you Al
1
by: mkadasi | last post by:
i want to get attachements from outlook and save under windows folder but through programmatically in vb.net
0
by: Kilimanjaro | last post by:
I am using a CDO DropDirectory to get all the messages that are bounced. I loop through each one, do some analysis on it by gettting the TextBody and Attachements. When I am done, I call Delete()...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.