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
Printable View
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
You could have an array with all the special character in it like so:
vb Code:
Dim arr(7) as String = {"!","@","#","$","%","^","&","*"} 'Then loop through the special character array and replace the ones in the csv text with "". For each sc as string in arr myCSVText = myCSVText.Replace(sc,"") Next
Justin
Use parameter objects to add values to your sql command, rather than concatonating data.
Can you please elaborate little bit more. Thanks in advance!!