简体   繁体   English

语法错误:“10”运算符后缺少操作数

[英]Syntax error: Missing operand after '10' operator

I have a code like this:我有这样的代码:

DataRow[] foundRows = dsFoxhillComp.Tables["RotaComp"].Select(findAssignee);
int test = foundRows.Length;

find Assignee is the result of this: find Assignee 是这样的结果:

string combobox2 = comboBox2.SelectedItem.ToString();
string assignee = combobox2.Substring(0, 5).ToString();
string assignedShift = "";
string assignedDate = (item.SubItems[1].Text.ToString());

if (dateTimePicker2.Value >= Convert.ToDateTime("09:00:00") && dateTimePicker2.Value < Convert.ToDateTime("12:59:59"))
{
    assignedShift = "1";
}
else if (dateTimePicker2.Value >= Convert.ToDateTime("13:00:00") && dateTimePicker2.Value < Convert.ToDateTime("16:59:59"))
{
    assignedShift = "2";
}
else if (dateTimePicker2.Value >= Convert.ToDateTime("17:00:00") && dateTimePicker2.Value < Convert.ToDateTime("19:59:59"))
{
    assignedShift = "3";
}
string findAssignee = assignee + assignedShift + assignedDate;

This is, I hope, going to either find or not find something in my database, so I can then use that as a comparison for an If statement, I have seen people use similar things on different sites.我希望这是在我的数据库中找到或不找到某些东西,因此我可以将其用作 If 语句的比较,我已经看到人们在不同的网站上使用类似的东西。 But when I run it, I get the following error:但是当我运行它时,我收到以下错误:

System.Data.ExpressionNode Parse()Syntax error: Missing operand after '10' operator. System.Data.ExpressionNode Parse() 语法错误:“10”运算符后缺少操作数。

I have no idea what could be causing this.我不知道是什么原因造成的。 Google searching had said something about apostrophes being in the dataset, but I've checked, and there shouldn't be.谷歌搜索曾说过数据集中有撇号,但我已经检查过,不应该有。 Any advice would be greatly appreciated.任何建议将不胜感激。

Thanks.谢谢。

So, the comment from Matthias R. Jessen was correct and worked, so Matthias, thank you very much.所以,Matthias R. Jessen 的评论是正确的并且有效,所以,Matthias,非常感谢你。 So that there's a logged answer, what worked was:所以有一个记录的答案,有效的是:

 .Select($"[ColumnName] LIKE '%{findAssignee}%'"); 

As opposed to my original code, which I have now replaced.与我现在已替换的原始代码相反。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM