C# MySql查询未返回预期的数据

C# MySql查询未返回预期的数据,c#,mysql,C#,Mysql,我使用mysql工作台编写了这个查询。。C平台 我一次插入combobox值和textbox值,但没有得到ans "select * from clinic_app_database.appointment_details1 where ' " + this.txtCView.SelectedItem + " ' = ' " + this.txt_givenID.Text + "';"; 如果有人知道,请给我正确的语法 提前感谢您正在将txtCView.SelectedItem传递给查

我使用mysql工作台编写了这个查询。。C平台

我一次插入combobox值和textbox值,但没有得到ans

"select * from clinic_app_database.appointment_details1 where ' " + 
 this.txtCView.SelectedItem + " ' = ' " + 
 this.txt_givenID.Text + "';";
如果有人知道,请给我正确的语法

提前感谢

您正在将txtCView.SelectedItem传递给查询,而不是传递它的值。 此外,在值的开头和结尾添加的额外空格正在修改字符串。 试试这个:

select * from tablename where (here am using combobox for value) = textbox;

错误1“object”不包含“Value”的定义,并且找不到接受类型为“object”的第一个参数的扩展方法“Value”。是否缺少using指令或程序集引用?C:\Users\DELL\documents\visual studio 2010\Projects\CMS003\CMS003\Form1.cs 126 122 CMS003是txtCView而不是asp.net下拉列表控件?txtCView是什么类型的控件?从clinic_app_database.appointment_details1中选择*,其中+this.txtCView.SelectedItem.Value+='+this.txt_givenID.Text+';\u这就是我得到的答案
"select * from clinic_app_database.appointment_details1 where '" + 
 this.txtCView.SelectedItem.Value + "' = '" + this.txt_givenID.Text + "';";