查询表达式中缺少(运算符)
本文关键字:运算符 查询表 表达式 查询 | 更新日期: 2023-09-27 17:56:26
Lid是ms access中的自动编号字段。错误消息:查询表达式"Lid="中缺少(运算符)
db.Search_Grid_Add(LoanInfo_dgv, "Select * From Loan_Info Where Lid=" + LoanId_cb.Text + "");
也许LoanId_cb.Text
不解析为 int?尝试:
int lid;
string lidText = LoanId_cb.Text.Trim();
if(int.TryParse(lidText , out lid))
{
db.Search_Grid_Add(LoanInfo_dgv, "Select * From Loan_Info Where Lid="+lidText );
}
else
{
MessageBox.Show(lidText + " can't be parsed as int.");
}