Home All Groups Group Topic Archive Search About
Author
12 Jan 2006 10:32 AM
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

Author
12 Jan 2006 12:05 PM
Peter Proost
Hi,

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

Hth,
Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)


Show quoteHide quote
"Chubbly Geezer" <chubbly_geezer@newsgroup.nospam> schreef in bericht
news:#pzJPR2FGHA.1396@TK2MSFTNGP11.phx.gbl...
> 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
>
>
Author
13 Jan 2006 5:32 AM
Yuan Ren[MSFT]
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
Author
13 Jan 2006 7:35 AM
Peter Proost
Hi I have to say I like my new name, Greetz ;-)

but it actualy is Peter ;-)

Greetz (short for greetings) Peter :-)

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

""Yuan Ren[MSFT]"" <v-y***@microsoft.com> schreef in bericht
Show quoteHide quote
news:K9E7GLAGGHA.3944@TK2MSFTNGXA02.phx.gbl...
> 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
>
Author
13 Jan 2006 8:10 AM
Cor Ligthert [MVP]
It took a while that I renewed my mails. My message was seperate from yours
not an addition.

Cor
Author
16 Jan 2006 3:24 AM
Yuan Ren[MSFT]
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
Author
16 Jan 2006 7:20 AM
Peter Proost
Indeed, I am a happy man :-) ;-)

Greetz Peter
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

""Yuan Ren[MSFT]"" <v-y***@microsoft.com> schreef in bericht
Show quoteHide quote
news:Gold1xkGGHA.1240@TK2MSFTNGXA02.phx.gbl...
> 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
>
Author
13 Jan 2006 8:01 AM
Cor Ligthert [MVP]
Yuan,

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

With Greetz he says something as.

See you.

:-))

Cor
Author
16 Jan 2006 9:47 AM
Chubbly Geezer
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






""Yuan Ren[MSFT]"" <v-y***@microsoft.com> wrote in message
Show quoteHide quote
news:K9E7GLAGGHA.3944@TK2MSFTNGXA02.phx.gbl...
> 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
>
Author
17 Jan 2006 8:46 AM
Yuan Ren[MSFT]
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
Author
18 Jan 2006 10:53 AM
Chubbly Geezer
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


""Yuan Ren[MSFT]"" <v-y***@microsoft.com> wrote in message
Show quoteHide quote
news:gfjtHK0GGHA.224@TK2MSFTNGXA02.phx.gbl...
> 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
>
Author
19 Jan 2006 12:19 PM
Yuan Ren[MSFT]
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