"select * from clinic_app_database.appointment_details1 where ' " +
this.txtCView.SelectedItem + " ' = ' " +
this.txt_givenID.Text + "';";
我使用 mysql workbench .. C# 平台编写了这个查询
我一次插入组合框值和文本框值,但没有得到答案。
select * from tablename where (here am using combobox for value) = textbox;
如果有人知道,请告诉我正确的语法
提前致谢
最佳答案
您正在将 txtCView.SelectedItem
传递给查询,而不是传递它的值。
此外,您在值的开头和结尾添加的额外空格正在修改字符串。
试试这个:
"select * from clinic_app_database.appointment_details1 where '" +
this.txtCView.SelectedItem.Value + "' = '" + this.txt_givenID.Text + "';";
关于c# - MySql 查询没有返回预期的数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25865992/