数据表验证 [英] DataTable validation

查看:114
本文介绍了数据表验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个asp.net应用程序,我想在其中验证数据表行并检查它是否与sql server table中存在的数据类型匹配.如果不匹配,则应删除特定行,并在过滤无效行后使用新的数据表插入数据库使用sqlbulkcopy.基本上,数据来自excel电子表格,其中包含成千上万条记录,这些记录已转换为datatable并使用sqlbulkcopy插入.对此有何帮助.非常紧急.


谢谢,
Dwarak

Hi,

i have a asp.net application in which i want to validate datatable rows and check if it matches datatype present in sql server table.If it doesnt match it should remove the particular row and after filtering invalid rows ,with new datatable i should insert into database using sqlbulkcopy.Basically the data comes from excel spreadsheet which contains thousands of records which is converted to datatable and inserted using sqlbulkcopy.Could any one help on this.It is very urgent.


Thanks,
Dwarak

推荐答案

我看不到是什么在阻止你?

逐行读取行...,然后根据有效性将有效行添加到数据表中.数据表准备就绪后,将其发送以进行更新.

您说的很紧急,请尝试一下!
I don''t see what''s stopping you?

Read the rows one-by-one... and based on the validity add the valid row to a datatable. Once the datatable is ready send it for an update.

You said it''s urgent, give it a try!




我想你是说要遍历每一行并将其过滤掉.但是我想知道我们如何检查数据行中的每一列是否与sql表的数据类型匹配.您能为此提供任何代码吗?

谢谢
Dwarak
Hi,

I think you are saying to iterate each row and filter it out.But i want to know how can we check each column in datarow whether it matches the datatype of sql table. could you give any code on this.

Thanks
Dwarak


谢谢sandeep我得到了答案.
Thanks sandeep i got the answer.


这篇关于数据表验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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