我的程序中有这么一行代码:
String sql="select * from table2 where 分院 = '" & department & "' ";
其中
分院 为数据库中一表的列名,数据类型是char;
department 为string
编译时告诉我类型不匹配
String sql="select * from table2 where 分院 = '" & department & "' ";
其中
分院 为数据库中一表的列名,数据类型是char;
department 为string
编译时告诉我类型不匹配
应是这样吧。
String sql="select * from table2 where 分院 = '" + department ;
试试
->
String sql="select * from table2 where 分院 = '" + department + "' ";
不是你说的错误:
分院 为数据库中一表的列名,数据类型是char;
department 为string
你的代码还没有执行,是编译出错,怎么会与数据库有关呢?