如何在c ++ dao jet数据库中更改密码 [英] How to change password in c++ dao jet database

查看:72
本文介绍了如何在c ++ dao jet数据库中更改密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在运行时更改Access 97数据库密码。 以下代码不起作用;有关如何更改密码的任何建议:


   CDaoDatabase db;

   char * pwd = " ;; PWD = MyPass"; $
   db.Open(" test.mdb",TRUE,FALSE,pwd);

   CString strSQL;

   strSQL.Format(" ALTER DATABASE PASSWORD'%s''NewPass'",& pwd [5]);

   db.Execute(strSQL);

   db.Close();






解决方案

根据一些样本(例如
https ://social.msdn.microsoft.com/forums/en-US/4a2e342e-d7e4-4aaf-a1e3-f57248d9ebde
),新密码在旧密码之前,并使用'[]'。


您是否在Access中手动使用查询检查语句?


I am trying to change my Access 97 database password at runtime.  The following code does not work; any suggestions on how to change the password:

  CDaoDatabase db;
  char* pwd = ";PWD=MyPass";
  db.Open("test.mdb", TRUE, FALSE, pwd);
  CString strSQL;
  strSQL.Format("ALTER DATABASE PASSWORD '%s' 'NewPass'", &pwd[5]);
  db.Execute(strSQL);
  db.Close();



解决方案

According to some samples (e.g. https://social.msdn.microsoft.com/forums/en-US/4a2e342e-d7e4-4aaf-a1e3-f57248d9ebde), the new password precedes the old one, and ‘[ ]’ are used.

Did you check the statement using a query manually in Access?


这篇关于如何在c ++ dao jet数据库中更改密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆