我有这个beloq查询给了我一个例外.现在j.job_quote.JobQuoteID是一个null的标识列,我们试图创建一个检查,如果null然后标识为0.请帮助我为什么我得到问题,我该怎么办来处理它
var Qryjob = (from j in at.jobs
where j.JobID == Convert.ToInt32(jobid)
select new {
JobID = j.JobID,
InsertedDate = j.InsertedDate,
FirstName = j.user.FirstName,
LastName = j.user.LastName,
City = j.user.City,
ServiceName = j.service.ServiceName,
ServiceTypeName = j.service_type.ServiceTypeName,
BudgetName = j.budget.BudgetName,
IsApproved = j.IsApproved,
IsAssigned = j.IsAssigned,
IsQuoted = j.IsQuoted,
job_notif_price = j.job_notif_price,
Description = j.Description,
PaymentTypeName = j.payment_type.PaymentTypeName,
DuePeriodName = j.due_period.DuePeriodName,
QuoteStatus = j.job_quote.QuoteStatus,
JobStatus = j.job_quote.JobStatus,
comments = j.job_quote.comments,
IsPartnerApply = j.job_quote.IsPartnerApply,
Applycomment = j.job_quote.ApplyComments,
JobQuoteID = j.job_quote.JobQuoteID ?? 0 …Run Code Online (Sandbox Code Playgroud) 如果我有一个整数列表:
List<int> myValues = new List<int>(new int[] { 1, 2, 3, 4, 5, 6 } );
Run Code Online (Sandbox Code Playgroud)
如何从该列表中获得3个随机整数?
在控制器动作中进行重定向我使用:
$this->redirect(array('controller' => 'tools', 'action' => 'index'));
Run Code Online (Sandbox Code Playgroud)
或这个
$this->redirect('/tools/index');
Run Code Online (Sandbox Code Playgroud)
当我使用重定向传递数据时,我使用:
$this->redirect('tools/index/?myArgument=12');
Run Code Online (Sandbox Code Playgroud)
但我找不到如何通过"this-redirect-array"表示法传递"myargument".
我不想使用它,因为一些路由问题:
$this->redirect(array('controller' => 'tools', 'action' => 'index', "myArgument"));
Run Code Online (Sandbox Code Playgroud)
我需要这样的东西:
$this->redirect(array('controller' => 'tools', 'action' => 'index', "?myArgument=12"));
Run Code Online (Sandbox Code Playgroud) string.IsNullOrEmpty(myString.Trim()) VS string.IsNullOrWhiteSpace(myString)
哪一个更快或更可靠,为什么?
我有一个数字,它的长度将超过10个数字,因此我无法将其保存在INTEGER变量中.所以我把它保存在一个LONG变量中.现在问题是,在为LONG Variable添加数字时,它返回Round值.我在C#工作.
对于Eg:
long empId = 00000000001;
long answer = empId + 1; // 00000000001 + 1 = 2;
// answer == 2;
Run Code Online (Sandbox Code Playgroud)
但预计答案是"00000000002",如何实现这一目标..
提前致谢..
我有一个奇怪的问题,事实证明很难诊断。将包含命名空间的程序集引用添加Matrix.System到 Windows 服务项目后,我现在在编译服务时收到此错误:
命名空间“Matrix.System”中不存在类型或命名空间名称“ComponentModel” 命名空间“Matrix.System”中不存在类型或命名空间名称“ServiceProcess”
但错误是在服务中生成的:
private System.ComponentModel.IContainer components = null;
private System.ServiceProcess.ServiceInstaller serviceInstaller1;
Run Code Online (Sandbox Code Playgroud)
在服务设置项目中我得到了这个:
无法找到程序集“Apache.NMS.ActiveMQ.dll”的依赖项“IONIC.ZLIB”(签名=“EDBE51AD942A3F5C”版本=“1.9.1.5”)
NMS 程序集已经在设置项目中,并且一切正常,直到我添加Matrix.System程序集
根据这篇文章,使用Exception类的Message字段不是一个好的编程习惯.
但是,当我尝试ArgumentException在我的项目中抛出异常(例如)时,如何添加自定义异常信息?我应该使用Exception.Data房产吗?
而不是使用:
throw new ArgumentException("My Custom Info.");
Run Code Online (Sandbox Code Playgroud)
我应该使用:
ArgumentException ex = new ArgumentException();
ex.Data["CustomInfo"] = "My Custom Info.";
throw ex;
Run Code Online (Sandbox Code Playgroud)
如果我不使用Message字段,代码会变得很麻烦.
不使用Exception类的Message字段是一种好习惯吗?
提前致谢.
以某种方式可以使MySQL命令执行此操作:
UPDATE FROM players WHERE column1 > column2 SET column2 = column1
有什么想法可以做到这一点?或者我必须运行2个mysql命令?一个选择,一个更新?
我正在使用这样的uasort函数:
uasort($entity_list, 'sortArray');
function sortArray($a, $b) {
if($a['fixed_column_name'] == $b['fixed_column_name']) {
return 0;
}
return ($a['fixed_column_name'] < $b['fixed_column_name']) ? -1 : 1;
}
Run Code Online (Sandbox Code Playgroud)
我想将一个参数传递给sortArray函数,如下所示:
uasort($entity_list, 'sortArray($arg)');
function sortArray($a, $b, $arg) {
$larg = $arg;
if($a[$larg] == $b[$larg]) {
return 0;
}
return ($a[$larg] < $b[$larg]) ? -1 : 1;
}
Run Code Online (Sandbox Code Playgroud)