Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. validate .csv file columns values

validate .csv file columns values

Scheduled Pinned Locked Moved Visual Basic
questioncsharpasp-net
5 Posts 4 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    montu3377
    wrote on last edited by
    #1

    Hi, I am facing one huddles in my project.If any one gives solution then it would be great. let me describe : We have user requirement that user has to upload .csv file from client browser which contains around 4 columns.Columns includes like firstname,lastname,SSN,DOB field.Now when user upload .csv file (which may containts more then 10K records) we have to validate those fileds format like firstname should be charater no numeric values include,each SSN value should be numeric not character values like that,so now how can i validate each and every value of each column for 10k records??? we are using asp.net with vb.net(as code behind).Can any body suggest me the good solution for that.??If you have any doubt to understand then feel free to ask me. I will thankfull for that in advance. regards, montu3377

    C 1 Reply Last reply
    0
    • M montu3377

      Hi, I am facing one huddles in my project.If any one gives solution then it would be great. let me describe : We have user requirement that user has to upload .csv file from client browser which contains around 4 columns.Columns includes like firstname,lastname,SSN,DOB field.Now when user upload .csv file (which may containts more then 10K records) we have to validate those fileds format like firstname should be charater no numeric values include,each SSN value should be numeric not character values like that,so now how can i validate each and every value of each column for 10k records??? we are using asp.net with vb.net(as code behind).Can any body suggest me the good solution for that.??If you have any doubt to understand then feel free to ask me. I will thankfull for that in advance. regards, montu3377

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      montu3377 wrote:

      how can i validate each and every value of each column for 10k records???

      In a loop? I really don't understand what you are having difficulty with. I think the problem is insufficiently defined. For example: What are you using to parse the file? What is to happen if an error occurs? Do you stop the process or do you skip the line? If you continue, how do you want to report it? Should it log if for an admin to look at, or should the user doing the upload be told?


      Upcoming Scottish Developers events: * Glasgow: Tell us what you want to see in 2007 My: Website | Blog | Photos

      M 1 Reply Last reply
      0
      • C Colin Angus Mackay

        montu3377 wrote:

        how can i validate each and every value of each column for 10k records???

        In a loop? I really don't understand what you are having difficulty with. I think the problem is insufficiently defined. For example: What are you using to parse the file? What is to happen if an error occurs? Do you stop the process or do you skip the line? If you continue, how do you want to report it? Should it log if for an admin to look at, or should the user doing the upload be told?


        Upcoming Scottish Developers events: * Glasgow: Tell us what you want to see in 2007 My: Website | Blog | Photos

        M Offline
        M Offline
        montu3377
        wrote on last edited by
        #3

        Hi , ok Good questions: let me give all answers : let's say .csv file has 10K rows with column firstname,lastname,SSN,DOB.Now you are checking record by record and if you find firstname in bad format like numeric then count that row as bad row and then continue for next record and like that you can get how much are good records and how much are bad records and at end of the finding,you need to show to user that let's say 1000 records are bad and 9000 records are good out of 10,000 records. This is how you have to report to user,so user can understand that what's problem with rest of records which are bad. so user can change those records and then upload .csv file again. I hope your now clear abt output.My main problem is to how to validate each and every rows (records).??If i will count one by one record then performance will be def. a issue. regards, Montu3377

        D 1 Reply Last reply
        0
        • M montu3377

          Hi , ok Good questions: let me give all answers : let's say .csv file has 10K rows with column firstname,lastname,SSN,DOB.Now you are checking record by record and if you find firstname in bad format like numeric then count that row as bad row and then continue for next record and like that you can get how much are good records and how much are bad records and at end of the finding,you need to show to user that let's say 1000 records are bad and 9000 records are good out of 10,000 records. This is how you have to report to user,so user can understand that what's problem with rest of records which are bad. so user can change those records and then upload .csv file again. I hope your now clear abt output.My main problem is to how to validate each and every rows (records).??If i will count one by one record then performance will be def. a issue. regards, Montu3377

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          montu3377 wrote:

          My main problem is to how to validate each and every rows (records).??If i will count one by one record then performance will be def. a issue.

          You don't have a choice here. You have to go through this file, one record at a time, parse and validate each field. A RegEx expression would probably speed things up a little bit.

          Dave Kreskowiak Microsoft MVP - Visual Basic

          J 1 Reply Last reply
          0
          • D Dave Kreskowiak

            montu3377 wrote:

            My main problem is to how to validate each and every rows (records).??If i will count one by one record then performance will be def. a issue.

            You don't have a choice here. You have to go through this file, one record at a time, parse and validate each field. A RegEx expression would probably speed things up a little bit.

            Dave Kreskowiak Microsoft MVP - Visual Basic

            J Offline
            J Offline
            Jason McBurney
            wrote on last edited by
            #5

            Dave Kreskowiak wrote:

            RegEx expression would probably speed things up a little bit.

            And since you are going to use the same 4 or 5 RegEx you may want to consired precompile them.

            montu3377 wrote:

            If i will count one by one record then performance will be def. a issue.

            If the Business does not require a sync response, then fire a new thread to do the validation and then email a report when complete. Just some other options.

            You can only be young once. But you can always be immature. - Dave Barry

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups