日期:2014-05-19  浏览次数:20402 次

sql语句问题?
txt_state_rk和   txt_style_rk   是   txtbox

string   ztai   =   txt_state_rk.Text;
string   xinghao   =   txt_style_rk.Text;

string   sql   =   "select   *   from   cangkulingjian   where   ztailj   =   ztai   and   nolj   =   xinghao   ";

这样能找到相关数据吗
但是提示有异常
System.Data.OleDb.OleDbException:   至少一个参数没有被指定值。

------解决方案--------------------
字段名或者表名写错了。
------解决方案--------------------
string sql = "select * from cangkulingjian where ztailj = ' "
+ ztai + " ' and nolj = ' " + xinghao + " ' ";
------解决方案--------------------
string sql = "select * from cangkulingjian where ztailj = ztai and nolj = xinghao ";改为
string sql = "select * from cangkulingjian where ztailj = ' "+ ztai+ " ' and nolj = ' "+ xinghao+ " ' ";