附加信息:标准表达式中的数据类型不匹配。 [英] Additional information: Data type mismatch in criteria expression.

查看:78
本文介绍了附加信息:标准表达式中的数据类型不匹配。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请告诉我们如何解决这个问题 

kindly Advise us how to solved this issue 

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { connection.Open(); OleDbCommand command1 = new OleDbCommand(); string query = "SELECT result FROM ReportQuery where PatientID = '"+ comboBox1.Text+ "' AND TestID = ' + 1 + '"; command1.CommandText = query; command1.Connection = connection; OleDbDataReader reader = command1.ExecuteReader(); while (reader.Read()) { textBox1.Text = reader["Result"].ToString(); }

  connection.Close();

  connection.Close();





推荐答案

可能
PatientID 是一个数字列,但 comboBox1.Text 不是数字。如果是数字,则不必使用撇号。

Probably PatientID is a numeric column, but comboBox1.Text is not a number. In case of numbers, you do not have to use apostrophes.

提供有关
PatientID TestID 列的详细信息,以及关于 comboBox 。还显示
查询的值

Give some details about the columns PatientID and TestID, and about the comboBox. Also show the value of the query.

此外,也许是时候进入参数化查询了。

由方式,你可以使用
如果而不是


这篇关于附加信息:标准表达式中的数据类型不匹配。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆