DataAdapter的填充命令禁止"写"手术 [英] DataAdapter Fill command prohibit "write" operation

查看:137
本文介绍了DataAdapter的填充命令禁止"写"手术的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有什么方法可以让我避免写操作,而数据集填充操作?

Is there any way I can avoid "write" operations while a dataset "Fill" operation ?

要我惊讶的是,如果我使用DataAdapter的填充运行这条命令文本 - >

To my surprise, if I run this commmand text using DataAdapter Fill ->

从表中删除

它成功,并删除它是一种关闭危险的,我想实现(将SQL中,将动态运行的配置文件)功能的所有记录。是否有当我们运行填充没有办法,我们可以禁止写操作命令。

it succeeds and removes all records which is kind off dangerous for the functionality I am trying to implement(putting sql in config file which will be run dynamically). Is there any way we can prohibit "write" operations when we are running "Fill" command.

问候 阿米特

推荐答案

有没有办法从一个DataAdapter做到这一点。你可以尝试一些prehemptive检查在字符串中,你将它传递到DataAdapter之前,但有很多方法可以解决的。

There's no way to do this from a DataAdapter. You could try some prehemptive checking on the string before you pass it into the DataAdapter, but there's a lot of ways to get around that.

如果你想禁止写入,那么你应该更改用户的权限在数据库上代替。然后,您可以通过存储过程做你的更新,例如。

If you want to prohibit writes, then you should change the user's permissions on the database instead. You could then do your updates through stored procedures, for example.

这篇关于DataAdapter的填充命令禁止"写"手术的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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