Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/55.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
比较编辑控件值与mysql数据库值_Mysql_Winapi_Visual C++ - Fatal编程技术网

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

比较编辑控件值与mysql数据库值,mysql,winapi,visual-c++,Mysql,Winapi,Visual C++,您好,我想在vc++中用where子句执行mysql查询 sql::ResultSet *res; stmt = con->createStatement(); res = stmt->executeQuery("SELECT * from MEMBERS"); 现在我想在查询中添加WHERE子句。但问题是我要比较的值来自编辑控件并存储在wchar\u t中。是否可以在WHERE和最后传递wchar\u t值我想检查返回值是否有行???经过一些尝试,我终

您好,我想在
vc++
中用where子句执行
mysql
查询

    sql::ResultSet *res;
    stmt = con->createStatement();
      res = stmt->executeQuery("SELECT * from MEMBERS");

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

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

pstmt = con->prepareStatement("select * from users where user_name =? and user_password=?");
  pstmt->setString(1,user);
  pstmt->setString(2,pass);
用于转换我使用的wchar\u t

wcstombs

使用WideChartMultiByte将wchar\u t转换为char。然后将其附加到查询中。或者,如果您只想使用ANSI版本的api,请在源代码中取消定义UTF8。