我正在运行一个非常标准的
INSERT INTO [table] (col1, col2, ...coln)
select * from #temp
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
消息245,级别16,状态1,行1
转换将varchar值'NULL'转换为数据类型int时失败.
我理解错误,但想知道为什么错误消息不识别导致问题的列.有没有一种简单的方法可以找到哪个列包含顽皮的null或者这只是一个让我看起来像工作效率高的工作而我真的只花了30分钟看着一个巨大的结果集而没有到达任何地方?
编辑:感谢帮助人员,但没有人真正回答这个问题.是否所有RDBMS都会发出类似的错误消息或者更有用?它的2012年...可能数千列的试验和错误应该已经死了!
我知道路径应该是相对于css文件的,但对于我试图用作游标的图像来说,情况似乎并非如此.
文件结构是:
Content/Site.css
Content/images/butteryfly.ani
Content/images/user.png
Run Code Online (Sandbox Code Playgroud)
的site.css:
.butterfly
{
cursor: url('images/butterfly.ani'), pointer;
}
/*this works*/
.ui-icon-user
{
background-image: url(images/user.png) !important;
background-position: 0 0;
}
Run Code Online (Sandbox Code Playgroud)
如果我将其更改为:
.butterfly
{
cursor: url('Content/images/butterfly.ani'), pointer;
}
Run Code Online (Sandbox Code Playgroud)
为什么相对URL不适用于游标?
编辑:在Chrome,Firefox或IE9中不起作用.在所有浏览器中,它显示手形光标而不是自定义光标.
编辑2:要跟进:我如何实际在我的网站上工作,因为html页面位于不同的级别?有没有办法在css中以某种方式指定相对URL,或者我应该将光标的副本放在与每个页面相同的级别(这很糟糕!)?
我无法使用visual studio测试套件和Moq成功运行MvcMailer的单元测试.我已经逐字逐句地复制了wiki中的示例,但每次都得到以下异常:
Test method MvcMailerTest.Tests.MailerTest.TestMethod1 threw exception:
System.ArgumentNullException: Value cannot be null.
Parameter name: httpContext
Run Code Online (Sandbox Code Playgroud)
代码如下:(使用VS单元测试框架 - 在使用nUnit时完全相同的错误,如示例中所示)
//Arrange: Moq out the PopulateBody method
var _userMailerMock = new Mock<UserMailer>();
_userMailerMock.Setup(mailer => mailer.PopulateBody(It.IsAny<MailMessage>(), "Welcome", null));
_userMailerMock.CallBase = true;
//Act
var mailMessage = _userMailerMock.Object.Welcome();
Run Code Online (Sandbox Code Playgroud)
在Welcome()方法中的以下行失败(直接从wiki复制):
PopulateBody(mailMessage, viewName: "Welcome");
Run Code Online (Sandbox Code Playgroud)
维基在这里:https://github.com/smsohan/MvcMailer/wiki/MvcMailer-Step-by-Step-Guide
类似(几乎完全相同)问题:MvcMailer:无法在使用Url.Action的Razor Views上完成NUnit测试
任何人都知道如何解决/解决这个问题?链接的问题说我需要模拟我已经完成的PopulateBody方法(根据维基).
我正在使用TempData传递其他消息以显示请求中的通知:
public ActionResult Address()
TempData["NotificationType"] = "error";
TempData["NotificationMessage"] = "There was an error updating the address.";
return RedirectToAction("Index", "Home");
}
public ActionResult Index()
{
if (TempData["NotificationType"] != null && TempData["NotificationMessage"] != null)
{
model.NotificationMessage = TempData["NotificationMessage"].ToString();
model.NotificationType = TempData["NotificationType"].ToString();
}
return View();
}
Run Code Online (Sandbox Code Playgroud)
索引视图:
<div id="NotificationType" data-notification_type="@Model.NotificationType"/>
<div id="NotificationMessage" data-notification_message="@Model.NotificationMessage" />
<script type=text/javascript>
if($('#NotificationType').data('notification_type') == 'error'){
Notify('error', "Error!", $('#NotificationMessage').data('notification_message'));
}
</script>
Run Code Online (Sandbox Code Playgroud)
然后我在视图中显示错误通知,它工作得很好.我的问题出现之后,如果我点击另一个链接,然后按浏览器中的后退按钮,通知再次显示.
有没有办法阻止通知重新显示?
编辑:看起来像它,因为它缓存索引视图,因为当我点击后退按钮时,它没有在操作中遇到断点.
假设我有一个具有以下属性的电子邮件类:
public string From { get; set; }
public string To { get; set; }
public string Subject { get; set; }
public string Body { get; set; }
public Dictionary<string, byte[]> Attachments { get; set; }
Run Code Online (Sandbox Code Playgroud)
我需要计算电子邮件的大小,如果电子邮件小于10MB,则以其他方式将内容作为传真发送(以防止其从目的地退回).
我可以相对容易地计算附件的大小.
有没有准确的方法来计算整个电子邮件大小?我猜我需要添加字符串的大小以及将附加的任何标题信息?
我无法弄清楚如何使用ajax获取部分视图来呈现分页列表.
我最接近它的工作是在部分视图中使用分页的例子,asp.net mvc
我基本上试图创建一个页面,其中包含每个用户的注释列表,其中页面可以像stackoverflow用户页面上的answers选项卡一样进行更改.
在第一次寻呼机点击时,分页工作正常,但是一旦我再次点击寻呼机,部分视图就会返回.
控制器:
public class ProductController : Controller
{
public IQueryable<Product> products = new List<Product> {
new Product{ProductId = 1, Name = "p1"},
new Product{ProductId = 2, Name = "p2"},
new Product{ProductId = 3, Name = "p3"},
new Product{ProductId = 4, Name = "p4"},
new Product{ProductId = 5, Name = "p5"}
}.AsQueryable();
public object Index()
{
return View();
}
public object Products(int? page)
{
var pageNumber = page ?? 1; // if no page …Run Code Online (Sandbox Code Playgroud) 假设我的数据库在orderstatus和orders之间有一对多的关系.我创建新订单的观点需要有一个ordertatuses下拉列表.
我有订单和订单状态的单独存储库以及操作订单和订单状态的单独服务.就像是:
public class OrderService : IOrderService
{
private readonly IRepository<Order> _orderRepository;
public OrderService(IRepository<Order> orderRepository) {_orderRepository = orderRepository }
public IEnumerable<Orders> GetAllOrders(){...}
}
public class OrderStatusService : IOrderStatusService
{
private readonly IRepository<OrderStatus> _OrderStatusRepository;
public OrderStatusService(IRepository<OrderStatus> orderStatusRepository) {_orderStatusRepository = orderStatusRepository }
public IEnumerable<OrderStatus> GetAllOrderStatuses(){...}
}
Run Code Online (Sandbox Code Playgroud)
我的订单控制器有一个对OrderService的引用,有点像这样:
public class OrderController : Controller
{
private readonly IOrderService orderService;
Run Code Online (Sandbox Code Playgroud)
从db获取orderstatuses列表的最佳方法是什么?
1)在OrderService中包含对两个存储库的引用,并包含一个将返回orderstatuses的方法.
public class OrderService : IOrderService
{
private readonly IRepository<Order> _OrderRepository;
private readonly IRepository<OrderStatus> _OrderStatusRepository; ...
Run Code Online (Sandbox Code Playgroud)
2)让控制器知道这两种服务,并使用GetOrderStatus方法获取OrderStatuses列表:
public class OrderController : Controller
{
private …Run Code Online (Sandbox Code Playgroud) 是否可以阻止Javascript调试器进入某些文件?
当Jquery JavaScript文件中抛出异常时,我特别不希望它中断:

其他第三方缩小文件也是如此...每次出现运行时错误时,它都会显示通知并打开文件.打破执行并打开缩小文件并不能帮助我找到错误原因.
我在我们的一台服务器上安装了以下COM对象,我需要重写...一些遗留代码使用该对象如下:
Set oEmail = CreateObject("SSDSCommunicator.EmailClass")
oEmail.Send(szFrom, szRecipients, szSubject, szEmailBody, SMTPServer, szErr, "", , , , True)
Run Code Online (Sandbox Code Playgroud)
我已经按照这个答案的例子,但我很难注册COM组件.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mail;
using System.Runtime.InteropServices;
namespace SSDSCommunicator
{
[InterfaceType(ComInterfaceType.InterfaceIsDual), Guid("DB38A91C-9EB6-4472-9A49-40722431E096")]
public interface IEmailClass
{
void launch();
bool Send(string szFrom, string szTo, string szSubject, string szMessage, string szSMTPServer, ref object szError, string szAttachments = "", string szReplyTo = "", string szCC = "", string szBCC = "", bool bHTMLBody = false);
}
[ClassInterface(ClassInterfaceType.None), Guid("A00C16DA-1791-4A3A-8D16-4765A9FAD060"), ProgId("SSDSCommunicator.EmailClass")] …Run Code Online (Sandbox Code Playgroud) c# ×4
asp.net ×2
asp.net-mvc ×2
ajax ×1
com ×1
css ×1
cvs ×1
debugging ×1
dll ×1
eclipse ×1
email ×1
javascript ×1
jquery ×1
moq ×1
mvcmailer ×1
pagedlist ×1
sql ×1
sql-server ×1
unit-testing ×1