小编flu*_*luf的帖子

SqlDependency有什么限制

我使用表作为消息队列,并使用SqlDependency"注册"以获取更新.我读到的每个地方的人都在说要注意它的局限性,但没有具体说明它们是什么.从我收集的内容来看,当表具有非常高的更新频率时,你会遇到问题,幸运的是我只看到每分钟最多10-20个值.

对SqlServer有哪些其他限制/影响?

c# sql-server-2005 sqldependency

42
推荐指数
4
解决办法
3万
查看次数

如何将图像流嵌入MailMessage

我将从Properties.Resources中的图像嵌入到MailMessage中时遇到了一些困难,目前图像未显示在我收到的电子邮件中.

我已经成功地从目录位置嵌入了图像,但是如果图像来自内存/应用程序则更喜欢.

这是我正在做的简化版本.

 Bitmap b = new Bitmap(Properties.Resources.companyLogo);
 MemoryStream logo = new MemoryStream();
 b.Save(logo, ImageFormat.Jpeg);



 MailMessage newEmail = new MailMessage(from, to);
 newEmail.Subject = subject;
 newEmail.IsBodyHtml = true;

 LinkedResource footerImg = new LinkedResource(logo, "image/jpeg");
 footerImg.ContentId = "companyLogo";
 AlternateView foot= AlternateView.CreateAlternateViewFromString(body + "<p> <img src=cid:companyLogo /> </p>", null, "text/html");

 foot.LinkedResources.Add(footerImg);

 newEmail.AlternateViews.Add(foot);             

 SmtpClient server = new SmtpClient(host, port);
 server.Send(newEmail);
Run Code Online (Sandbox Code Playgroud)

c# email stream

13
推荐指数
2
解决办法
3万
查看次数

在sqlConnections上使用'Using'有什么性能影响

我发现一篇文章说我使用我的sqlConnection:

using (SqlConnection sqlConnection = new SqlConnection(Config.getConnectionString()))
            {
                using (SqlDataAdapter dataAdapter = new SqlDataAdapter(query, sqlConnection))
                {
                    dataAdapter.Fill(dataSet);
                }
            }
Run Code Online (Sandbox Code Playgroud)

提高性能,因为它将对象放在方法的末尾.所以我一直在使用'使用'一段时间,在与其他开发人员聊天后,他们说多次创建和销毁实例不会真正提高性能.

如果我在所有dataAccess方法上使用'Using',那么对sqlserver和系统资源的性能影响是什么.由于连接多次连接和重新连接,sqlServer是否会受到更严重的打击?

c# sql performance

2
推荐指数
1
解决办法
300
查看次数

标签 统计

c# ×3

email ×1

performance ×1

sql ×1

sql-server-2005 ×1

sqldependency ×1

stream ×1