资源简介
C# 先将从数据库中获取数据转成DataTable然后将DataTable生成excel,并将excel添加附件发送邮件
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
using System.IO;
namespace SendMailDemo
{
public class Conn
{
public static string StrConn
{
get
{
//读取文本文件(txt)
//return Conn.getValue(@“C:\Users\Brambling\Desktop\Demo\SendMail\SendMail\DB_Config\DB_Config.txt“ “StrConn“);
//读取配置文件
//return ConfigurationManager.ConnectionStrings[“StrConn“].ToString();
//return ConfigurationManager.AppSettings[“Conn“].ToString();
//直接返回数据库连接字符串
return “Data Source=.;Initial Catalog=TC_MES_WEB_ADMIN;User ID=sa;Pwd=jm123!@#;Enlist=true;Pooling=true;Max Pool Size=300;Min Pool Size=0;Connection Lifetime=300;packet size=1000“;
}
}
public static SqlConnection SqlConn
{
get
{
return new SqlConnection(StrConn);
}
}
private static string getValue(string path string name)
{
string[] str = File.ReadAllLines(path);
for (int i = 0; i < str.Length; i++)
{
if (str[i].StartsWith(name))
{
return str[i].Replace(name + “=“ ““);
}
}
return ““;
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-04-18 16:21 SendMailDemo\
目录 0 2018-04-18 16:21 SendMailDemo\.vs\
目录 0 2018-04-18 16:21 SendMailDemo\.vs\SendMailDemo\
目录 0 2018-04-18 16:21 SendMailDemo\.vs\SendMailDemo\v14\
文件 43008 2018-04-18 21:18 SendMailDemo\.vs\SendMailDemo\v14\.suo
目录 0 2018-04-18 22:11 SendMailDemo\SendMailDemo\
文件 1003 2018-04-18 16:21 SendMailDemo\SendMailDemo.sln
文件 189 2018-04-18 16:21 SendMailDemo\SendMailDemo\App.config
目录 0 2018-04-18 16:21 SendMailDemo\SendMailDemo\bin\
目录 0 2018-04-18 21:16 SendMailDemo\SendMailDemo\bin\Debug\
文件 1602560 2014-06-26 06:40 SendMailDemo\SendMailDemo\bin\Debug\NPOI.dll
文件 419840 2014-06-27 15:44 SendMailDemo\SendMailDemo\bin\Debug\NPOI.OOxm
文件 422053 2014-06-27 15:44 SendMailDemo\SendMailDemo\bin\Debug\NPOI.OOxm
文件 85504 2014-06-27 15:44 SendMailDemo\SendMailDemo\bin\Debug\NPOI.Openxm
文件 153211 2014-06-27 15:44 SendMailDemo\SendMailDemo\bin\Debug\NPOI.Openxm
文件 1869824 2014-06-27 15:44 SendMailDemo\SendMailDemo\bin\Debug\NPOI.Openxm
文件 17408 2018-04-18 22:09 SendMailDemo\SendMailDemo\bin\Debug\SendMailDemo.exe
文件 189 2018-04-18 16:21 SendMailDemo\SendMailDemo\bin\Debug\SendMailDemo.exe.config
文件 32256 2018-04-18 22:09 SendMailDemo\SendMailDemo\bin\Debug\SendMailDemo.pdb
文件 22696 2018-04-18 22:11 SendMailDemo\SendMailDemo\bin\Debug\SendMailDemo.vshost.exe
文件 189 2018-04-18 16:21 SendMailDemo\SendMailDemo\bin\Debug\SendMailDemo.vshost.exe.config
文件 490 2015-10-22 09:54 SendMailDemo\SendMailDemo\bin\Debug\SendMailDemo.vshost.exe.manifest
文件 1547 2018-04-18 16:52 SendMailDemo\SendMailDemo\Conn.cs
文件 19026 2018-04-18 22:11 SendMailDemo\SendMailDemo\Form1.cs
文件 2032 2018-04-18 16:23 SendMailDemo\SendMailDemo\Form1.Designer.cs
文件 5817 2018-04-18 16:23 SendMailDemo\SendMailDemo\Form1.resx
目录 0 2018-04-18 16:21 SendMailDemo\SendMailDemo\obj\
目录 0 2018-04-18 21:28 SendMailDemo\SendMailDemo\obj\Debug\
文件 1464 2018-04-18 20:43 SendMailDemo\SendMailDemo\obj\Debug\DesignTimeResolveAssemblyReferences.cache
文件 7525 2018-04-18 21:16 SendMailDemo\SendMailDemo\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 965 2018-04-18 22:11 SendMailDemo\SendMailDemo\obj\Debug\SendMailDemo.csproj.FileListAbsolute.txt
............此处省略19个文件信息
相关资源
- WPF写的获取外部公网IP地址及发送邮件
- asp.netC#定时发送邮件
- C#使用SMTP服务器发送邮件
- C# POP3接收邮件程序(可用)
- C# Nlog日志使用并发送邮件
- C# 基于SMTP协议和SOCKET发送邮件及附件
- C#.net发送邮件完整源代码DEMO完整版
- winds服务,发送邮件且禁用违法规则的
- 调用OutLook发送邮件
- c#发送邮件(可以添加附件)
- C#多线程发送邮件发送工资条
- C#调用Outlook发送邮件
- 无需用户名和密码 直接发送邮件至对
- c#发送邮件类(含接收邮件和发送邮件
- C#发送邮件代码
- C#发送邮件工具(MailTest)
- 使用qq邮箱批量发送邮件 (支持富文
- c# 发送邮件
- mvc 发送邮件源码(验证邮件合法性)
- asp.net发送邮件
- C# 通过windows服务发送邮件
- c# 异步批量发送邮件
- C#发送邮件
- C# 发送邮件
- winform发送邮件源码(smtp)
- C#发送邮件
- C#发送邮件(smtp)
- smtp发送邮件
评论
共有 条评论