Results 1 to 4 of 4

Thread: Remove special characters from csv file

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2012
    Posts
    5

    Unhappy Remove special characters from csv file

    I have a csv file and it has some special characters that blocking to insert data into a SQL server.
    How I can remove the characters before it dumps data into SQL.
    Any idea will be appreciated.
    Thanks

  2. #2
    Frenzied Member
    Join Date
    Feb 2008
    Location
    Texas
    Posts
    1,288

    Re: Remove special characters from csv file

    You could have an array with all the special character in it like so:

    vb Code:
    1. Dim arr(7) as String = {"!","@","#","$","%","^","&","*"}
    2.  
    3. 'Then loop through the special character array and replace the ones in the csv text with "".
    4.  
    5. For each sc as string in arr
    6.  
    7. myCSVText = myCSVText.Replace(sc,"")
    8.  
    9. Next

    Justin
    You down with OOP? Yeah you know me!
    MCAD and MCMICKEYMOUSE (vb.net)

    ----

    If it even kinda helps... rate it : )

    Edit a Multi-page .tif file and save.

  3. #3
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: Remove special characters from csv file

    Use parameter objects to add values to your sql command, rather than concatonating data.
    That is the very essence of human beings and our very unique capability to perform complex reasoning and actually use our perception to further our understanding of things. We like to solve problems. -Kleinma

    Does your code in post #46 look like my code in #45? No, it doesn't. Therefore, wrong is how it looks. - jmcilhinney

  4. #4

    Thread Starter
    New Member
    Join Date
    May 2012
    Posts
    5

    Re: Remove special characters from csv file

    Can you please elaborate little bit more. Thanks in advance!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width