简体   繁体   English

在asp.net中使用c#验证数据表中的字段

[英]validating fields in datatable using c# in asp.net

I have an excel sheet which contains fields like我有一个 excel 表,其中包含诸如

employee ID,Employee Name,Email,Phone 

and their respective values.以及它们各自的值。

I want to import that excel sheet and then apply data validations to each field.我想导入该 Excel 表,然后将数据验证应用于每个字段。

I have created two folders in my local system, if the validation succeeds then move the excel sheet to first folder and if there is any validation error then move it to second folder.我在本地系统中创建了两个文件夹,如果验证成功,则将 excel 表移动到第一个文件夹,如果有任何验证错误,则将其移动到第二个文件夹。

What i tried is to import the excel sheet in a data table using oledb connection.我尝试的是使用oledb连接将excel表导入数据表中。

The problem is that after that how to do validations.问题是之后如何进行验证。 I am implementing the project in asp.net using c# , if it was a MVC then I could have added Data Annotations in model class but i have to implement it in asp.net.我正在使用c#在 asp.net 中实现该项目,如果它是MVC那么我可以在模型类中添加Data Annotations ,但我必须在 asp.net 中实现它。

根据您的选择使用 asp.net webforms 身份验证可能是此链接会有所帮助https://msdn.microsoft.com/en-us/library/cc488527.aspx或使用像这样的正则表达式单击此处

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM