Click here to Skip to main content
15,881,803 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,


Currently i'm doing Bulk data insert from Excel to SQL database.
My total logic is working fine for inserting. But my question is column name should be unique , now i want to check that.

for ex:

column1 : Title

but client enter the column1 value is "title"

In this case i don't want to insert data i want to display the error message .

How to do this can any one help me to resolve this issue.

Thanks in Advance.....
Posted

1 solution

you can use Regex class for such values.

C#
string originalValue="Title";
string enteredValue="title";
static bool IsValid(string orgValue, string entValue)
{
    return Regex.IsMatch(orgValue,"^" + entValue + "$"); //Remember, this will check for the whole string
}


If it returns false, Flag an Error.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900