int moduleId =int.Parse(this.comboBox1.SelectedItem.ToString());
DateTime startTime = DateTime.Parse(dateTimePicker1.Value.ToString());
DateTime endTime = DateTime.Parse(dateTimePicker3.Value.ToString());
string sql = "SELECT ModuleID as 传感器编号,CommTime as 采集时间,TPhyValue as 温度,TUnit as 单位(℃),WPhyValue as 湿度 ,WUnit as 单位 FROM ws_data where ModuleID=" + moduleId + " and commtime between '" + startTime + "' and '" + endTime + "'";
commtime 数据类型为(日期/时间)类型 ,格式为常规时间
提示数据类型不匹配,把查询时间的条件取掉就没有错了,时间的查询条件该怎么修改,望各位大虾指点