Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET C#4.0
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 16-Jan-13 20:05pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

you can use Regex class for such values.
 
    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.
  Permalink  

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

  Print Answers RSS
0 CPallini 550
1 Sergey Alexandrovich Kryukov 420
2 George Jonsson 288
3 Pheonyx 218
4 OriginalGriff 200
0 OriginalGriff 4,813
1 CPallini 3,850
2 Sergey Alexandrovich Kryukov 3,224
3 George Jonsson 2,552
4 Gihan Liyanage 2,186


Advertise | Privacy | Mobile
Web02 | 2.8.140905.1 | Last Updated 17 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100