获得异常“不能从指定的表中删除". [英] Getting an exception "could not delete from the specified tables"

查看:106
本文介绍了获得异常“不能从指定的表中删除".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CString cSql;
 CString strpath;
 CDaoDatabase pDatabase;
 strpath = "ODBC;DSN=CONTACT;UID=sa;PWD = cademtech";
 pDatabase.Open(NULL,0,0,strpath);
 cSql.Format(_T("DELETE FROM User WHERE Name=''%s''"),str);
 pDatabase.Execute(cSql);



当我尝试从SQL Server 2005 datbase中删除一些记录时,出现上述错误.



When I try to delete some reccords fom the sql server 2005 datbase, I get the above error. Can anyone please help me?

推荐答案

删除查询包含多个表,并且UniqueRecords属性设置为No.

1.在设计"视图中打开删除查询.
2.在查看"菜单上,单击属性".
3.将UniqueRecords属性设置为Yes.
4.保存查询,然后关闭它.
The delete query contains multiple tables, and the UniqueRecords property is set to No.

1. Open the delete query in Design view.
2. On the View menu, click Properties.
3. Set the UniqueRecords property to Yes.
4. Save the query, and then close it.


这篇关于获得异常“不能从指定的表中删除".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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