Email attachments?

  • Thread starter Thread starter Chubbly Geezer
  • Start date Start date
C

Chubbly Geezer

Hi

I'm in the process of converting an access db to vb2005. My old app has
code that sends an email with a table attachment formatted to excel. I want
to do the same within vb, i.e. create an email via code and attach the
records from an SQL table preferrably in xls format. The creating the email
is no problem, but am not sure of the best method to attach the records. I
now I could scroll through a dataset and use those records but was wondering
if there is a better way.

Thanks
 
Hi,

you can use dataset.WriteXml() to create an xml file based on the dataset.

Hth,
Greetz Peter
 
Hi Chubbly,

Welcome to MSDN newsgroup!

As Greetz's suggestion, I think the dataset.WriteXml() method is suitable
for the current scenario. You can use the xml generated by the method in
the mail.

I hope the above information helps, if you have any questions or concerns,
please do not hesitate to let me know. I am standing by to help you.

Yuan Ren [MSFT]
Microsoft Online Support
 
Hi I have to say I like my new name, Greetz ;-)

but it actualy is Peter ;-)

Greetz (short for greetings) Peter :-)
 
Yuan,

The guys name is Peter a regular (replier) in this newsgroup.

With Greetz he says something as.

See you.

:-))

Cor
 
It took a while that I renewed my mails. My message was seperate from yours
not an addition.

Cor
 
Hi Peter and Cor,

Thanks for you guys' reminder. Please forgive me for carelessness. But I
think maybe Peter are happy man so he "greet" all the time. Haha:)

Regards,

Yuan Ren [MSFT]
Microsoft Online Support
 
Thanks Guys.

Not really had much use for XML to date, so a bit green.

I'll look up the use and syntax in 'Help', unless you can point me in the
right direction.
I'm assuming I do not need to save the XML output to a file and then attach
the file. Can I just attached the XML output directly to the email. In
either instance, how would I use the XML with Excel.

thanks again

Chubbly
 
Hi Chubbly,

Thanks for your reply!

Let me explain my understanding for the current issue. There is a dataset
object and you want to export it to an xml data output. Then, you want to
use the output with the XSL format to generate a new output for the body of
the e-mail. If I have misunderstood anything, please let me know.

For this scenario, I suggest you export to the xml data output by calling
dataset.WriteXml method.

This method can write the object data into an output as the XmlReader,
string or file object. Then you use the output with calling
XslTransform.Transform method to generate a new output as the XmlReader,
string or file object. At last, you can attach the output into the body of
the email.

Below is a MSDN document which has more detailed information for these
methods:
WriteXml:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemdatadatasetclasswritexmltopic1.asp

Transform:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemxmlxslxsltransformclasstransformtopic8.asp

Additionally, here are some good samples from third party issues. These
samples demonstrate the implementation of the current issue:
¡°A Free HTML Report generator for DataSets¡±:
http://www.codeproject.com/csharp/datasetreportview.asp

¡°Programmatically using ADO.NET and XML¡±:
http://www.codeproject.com/cs/database/ADONET_and_XML.asp

I hope the above information helps, if you have any questions or concerns,
please do not hesitate to let me know. I am standing by to help you.

Regards,

Yuan Ren [MSFT]
Microsoft Online Support
 
What would be ideal is what our old system did in that it exported the
contents of an SQL table to an Excel file an attached this Excel file to an
email for sending.

Access actually did this with a 'sendobject' command and was simple.
However I do not seem able to do the same within VB2005.

Since your last post I've figure old that Excel can actually open and XML
data file, so I guess my best option is to attach one of these to an email.
I do not want to populate the email body at all, just send the table data.

Hope this is clear.

Chubbly
 
Hi Chubbly,

Thanks for your reply!
"Since your last post I've figure old that Excel can actually open and XML
data file, so I guess my best option is to attach one of these to an email.
I do not want to populate the email body at all, just send the table data."

I can not understand the issue clearly. If you just want to send the table
data, I wonder what origin of the table data is. Could you read the table
data and write it into a dataset object? If you can, I suggest you use the
way I mentioned in the previous thread to add the data into the body of
email.

Regards,

Yuan Ren [MSFT]
Microsoft Online Support
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top