直接写入SELECT * from user_table where user_name='rr'可以执行
SELECT * from user_table where user_name='龙力'就不行报错字符串 '龙力' 之前有未闭合的引号。
怎么回事啊

解决方案 »

  1.   

    在执行之前把要传送的sql输出来看看不就知道了吗?
      

  2.   

    什么数据库呀,在sql执行窗口里执行看看,还要看看是不是字符集的问题
      

  3.   

    sqlserverSELECT * from user_table where user_name='龙力'在sqlserver里可以执行
    在jsp里不行用的事jdbc桥
    j_strSQL="SELECT * from user_table where user_name ='龙力'";
    ResultSet RS=workM.executeQuery(j_strSQL);
    报错(aq.executeQuery:[Microsoft][ODBC SQL Server Driver][SQL Server]字符串 '龙力' 之前有未闭合的引号。)
    谁能帮我啊
      

  4.   

    j_strSQL="SELECT * from user_table where user_name ='龙力'";
    ResultSet RS=workM.executeQuery(j_strSQL);
    while(RS.next())
    {
    out.print("<td>"+RS.getString("user_name")+"</td>");
    out.print("<td>"+RS.getString("pwd")+"</td></tr>");
    }这是代码,大家看看那里错了
      

  5.   

    这问题我也碰到过,你试试这样看行不行。
    sql="SELECT * from user_table where user_name='"+rs.getString("table_col")+"'";
      

  6.   

    user_name ???你确定??user_name是保留字呀,你换一个字段名试试
      

  7.   

    这问题我也碰到过,你试试这样看行不行。
    sql="SELECT * from user_table where user_name='"+rs.getString("table_col")+"'";能说的具体点吗?rs.getString("table_col")还没有rs对象呢。
    为什么SELECT * from user_table where user_name ='龙力'   不行
    SELECT * from user_table where user_name ='rr'就可以呢
      

  8.   

    这个我碰到过,在sqlserver中,中文是可以执行的,但是到了程序里面却是不可以的。
    我是这样解决的。
    String str=new String(("中文").getBytes("ISO8859-1"));
    SELECT * from user_table where user_name='"+str+"';
      

  9.   

    String sql = "SELECT * from user_table where user_name='";
    sql = sql + d_name;
    sql = sql + "'";这样应该可以了,我都是这样的
      

  10.   

    SELECT * from user_table where user_name='"+d_name+"'"
    里面的单引号有问提吧'和’不一样的,你再试试看
      

  11.   

    把SQL语句:SELECT * from user_table where user_name=值写到SQL Server或该数据库里面去测试,如果有没有问题的话就不是SQL语句有错!
    如果有错的话原因1.user_table 或user_name为SQL Server或数据库的关键字,可以用"[]"把它们括起来
      

  12.   

    可能‘有问题。这样试一下。j_strSQL="SELECT * from user_table where user_name =\'龙力\'";