Lid是ms访问中的自动编号字段。 错误消息:查询表达式'Lid ='
中缺少(运算符)db.Search_Grid_Add(LoanInfo_dgv, "Select * From Loan_Info Where Lid=" + LoanId_cb.Text + "");
答案 0 :(得分:3)
也许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.");
}