该表达式包含无效的字符串常量: '
此代码位于文本框更改事件中。
dds.Tables["IncomeGenerator"].DefaultView.RowFilter = "' 收入如 '" + txtSearch.Text + "' 或费用如 '" + txtSearch.Text + "' 或日期 LIKE '" + txtSearch.Text + "' 或余额 LIKE '" + txtSearch.Text + "' 或描述 LIKE '" + txtSearch .文本+“'”;
当我运行它时,它给出一个错误,指出“表达式包含无效的字符串常量:'。”
有人可以帮助我吗?
我的收入、支出和余额的数据类型为浮点型,日期为日期时间。我希望它能有所帮助。有人可以指导我纠正错误并帮助我
this code is in Textbox Change event.
dds.Tables["IncomeGenerator"].DefaultView.RowFilter = "' Income LIKE '" + txtSearch.Text + "' OR Expenses LIKE '" + txtSearch.Text + "' OR Date LIKE '" + txtSearch.Text + "' OR Balance LIKE '" + txtSearch.Text + "' OR Description LIKE '" + txtSearch.Text + "'";
when i run it, it gives a error saying " The expression contains an invalid string constant: '. "
can someone help me.
my Income, Expenses and Balance is Data Type Float and Date is Datetime. i hope it may help. can someone guide me with the mistake and help me
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
很难确定,但有时当我从网页或文字处理程序复制代码时,我会无意中包含一个“书籍引用”(http://en.wikipedia.org/wiki/Quotation_mark_glyphs),这会把事情搞砸。
看起来您发布的示例中可能有一些。尝试确保所有引用都是直接的上下引用,而不是开头和结尾的“书籍引用”。
It's hard to tell for sure, but sometimes when I copy code from a web page or word processor, I inadvertently include a "book quote" (http://en.wikipedia.org/wiki/Quotation_mark_glyphs) that screws things up.
It looks like there may be some in the sample you posted. Try making sure all the quotes are the straight-up-and-down quotes, and not the begin-end "book quotes".