如何在ConsoleApplication中通过电子邮件发送GridView数据 [英] How to email GridView Data in ConsoleApplication

查看:84
本文介绍了如何在ConsoleApplication中通过电子邮件发送GridView数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我想从数据库中获取数据并将数据填充到gridview,然后将gridview数据发送给电子邮件,这是我的任务.请帮我,我已经在web应用程序上完成了,但是我不知道如何创建一个gridview并将gridview数据发送到控制台应用程序中的电子邮件.请给我一些示例代码.

谢谢与问候,
Raghu.

Hi,
I want to get data from database and fill the data to gridview and then send the gridview data to email this is my task. please help me i have done it on webapplication but i don''t know how to create a gridview and send gridview data to email in Console Application. please give me some sample code.

Thanks&Regards,
Raghu.

推荐答案



我想先纠正你.在控制台应用程序中,DataGridview将不可用.

其次,逐步创建UserControl:使用分页的DataGridView [ ^ ]本文将对您绑定dataGridView数据有帮助.当然,您需要付出一些努力.

第三,您可以在具有datagridview的表单中添加一个按钮,并且可以像在Web应用程序中发送电子邮件一样发送电子邮件.如果在绑定dataGridView时需要发送数据,则可以在将DataSource设置为DataGridView之后添加一个函数.发送电子邮件的功能将遍历您的数据源,并创建一个HtmlTable并将其添加到电子邮件的正文中.

希望这对您有帮助,
谢谢
-Amit Gajjar
Hi,

I would like to correct you first. In console application DataGridview will not be available.

Second, Step by Step Creating UserControl : DataGridView With Paging[^] this article will be helpful for you to bind dataGridView data. Ofcourse you need to give some effort.

Third, You can add one button in the form where you have datagridview and you can send email the same way you are sending in web application. If you need to send data when dataGridView is bind then you can add one function after setting DataSource to the DataGridView. Function for sending email will iterate through your DataSource and create one HtmlTable and add it in the Body of your email.

Hope this helps you,
Thanks
-Amit Gajjar


这篇关于如何在ConsoleApplication中通过电子邮件发送GridView数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆