只读ADO连接仍然允许写入数据库吗? [英] Read only ADO connection still allows writing to database?

查看:201
本文介绍了只读ADO连接仍然允许写入数据库吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经通过使用ADO(通过一组ADO类-版本2.20)连接到了我的SQL Server 2005数据库卡洛斯·安托尼(Carlos Antollini)).现在,我已将连接模式设置为ReadOnly

I have connected to my SQL Server 2005 database by using ADO (through A set of ADO classes - version 2.20 by Carlos Antollini). Now I have set the connection mode to be ReadOnly

CADODatabase *pDatabase = NULL;
pDatabase = new CADODatabase();
pDatabase->SetConnectionString(MyConnectionString);
pDatabase->SetConnectionMode(CADODatabase::connectModeRead);
pDatabase->Open();

SetConnectMode()调用ADODB::Connection15::PutMode
CADODatabase::connectModeReadadModeRead.

现在,我的理解是,设置adModeRead模式应该使数据库连接为只读.但是对连接的简单测试表明,我可以使用该连接来创建和删除表,以及插入和更新数据.

SetConnectMode() calls ADODB::Connection15::PutMode
and CADODatabase::connectModeRead is adModeRead.

Now my understanding is that setting the adModeRead mode should make the database connection read-only. But a simple test of the connection shows that I can use the connection to create and drop tables, as well as insert and update data.

How can I make the connection truely read-only?

推荐答案

您需要在连接字符串本身中设置连接模式.

请在Google上搜索以了解操作方法.

我在基于VB的应用程序中遇到同样的问题.我使用上述技术找到了相同的解决方案.
You need to set the connection mode in connection string itself.

Please search on the google to find out how it is done.

I have same problem in my VB based application . I found the same solution using above technique.


这篇关于只读ADO连接仍然允许写入数据库吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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