将编辑控件值与mysql数据库值进行比较

时间:2013-12-16 09:16:46

标签: mysql winapi visual-c++

您好我想在mysql中使用where子句

执行vc++查询
    sql::ResultSet *res;
    stmt = con->createStatement();
      res = stmt->executeQuery("SELECT * from MEMBERS");

现在我想在查询中添加WHERE子句。但问题是我想要比较的值来自编辑控件并存储到wchar_t。是否可以在最后的位置传递wchar_t值我想检查返回值是否有行?

1 个答案:

答案 0 :(得分:0)

经过一番尝试,我终于找到了答案

pstmt = con->prepareStatement("select * from users where user_name =? and user_password=?");
  pstmt->setString(1,user);
  pstmt->setString(2,pass);

用于转换wchar_t我用过

wcstombs