如何通过仅击中数据库一次来验证数据库中的一组数据? [英] how to validate a set of data from database by hitting database only once ?

查看:61
本文介绍了如何通过仅击中数据库一次来验证数据库中的一组数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在数据表中有一组值.现在我必须用数据库中的表来验证这些数据.我不想一一打数据库来验证每个数据行.请提出任何一种我可以通过只打一次数据库即可验证所有这些数据的方法.

解决方案

如果您知道要预先执行的SQL语句,您可以将它们捆绑到一个数据库调用中,并使用ADO.NET返回多个结果集.


将数据集作为XML文档发送到数据库,在存储过程中使用OPENXML进行转换将其恢复为表格格式并进行验证.请参考 http://msdn.microsoft.com/en-us/library/ms186918.aspx [ ^ ]


在Ado.net中创建表,将该表存储在数据表中并与现有表匹配.就是这样.


i have a set of values in a datatable . now i have to validate these data with my table in database . I dont want to hit the database one by one to verufy each datarow . Please suggest any method in which i can validate all theses data by hitting database only once .

解决方案

If you know which SQL statements you''re going to execute beforehand, you can bundle them into one call to the database, and return multiple result sets using ADO.NET


Send the dataset as an XML document to the database, use OPENXML in the stored procedure to convert it back to table format and do your validations. refer http://msdn.microsoft.com/en-us/library/ms186918.aspx[^]


bring the table in Ado.net store that table in a datatable and match with your existing table. that''s it.


这篇关于如何通过仅击中数据库一次来验证数据库中的一组数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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