J
Justin Fancy
Hi everyone,
I need to replace all instances of a double quote(") with two single
quotes('') in a text file. I already have some replacements of strings
going on, but I tried this one, but the syntax is being read wrong.
Here is the code:
lineFile1 = sr.ReadLine
Dim sb As New System.Text.StringBuilder(lineFile1)
sb.Replace("C:", "")
sb.Replace("x:", "")
sb.Replace("wwwroot", "")
sb.Replace("\", "/")
sb.Replace("!", "1")
sb.Replace("&", "2")
sb.Replace("cs-uri-stem", "")
lineFile1 = sb.ToString()
The reason why I want to achieve this is because when I read the lines
of the text file, using SB.REPLACE(""","''") into an access database
table, it gives me an unhandled exception error:
SYNTAX ERROR: MISSING OPERATOR IN QUERY EXPRESSION
which means that the database is treating it as an sql statement, which
is not what I want. I want it to be sent o the table without any
errors. Its a big txt file, so it runs for a while, but it hangs up on
the double quotes. I don't suppose it will hang on the single quotes if
I change it?
Any suggestions??
Justin Fancy
I need to replace all instances of a double quote(") with two single
quotes('') in a text file. I already have some replacements of strings
going on, but I tried this one, but the syntax is being read wrong.
Here is the code:
lineFile1 = sr.ReadLine
Dim sb As New System.Text.StringBuilder(lineFile1)
sb.Replace("C:", "")
sb.Replace("x:", "")
sb.Replace("wwwroot", "")
sb.Replace("\", "/")
sb.Replace("!", "1")
sb.Replace("&", "2")
sb.Replace("cs-uri-stem", "")
lineFile1 = sb.ToString()
The reason why I want to achieve this is because when I read the lines
of the text file, using SB.REPLACE(""","''") into an access database
table, it gives me an unhandled exception error:
SYNTAX ERROR: MISSING OPERATOR IN QUERY EXPRESSION
which means that the database is treating it as an sql statement, which
is not what I want. I want it to be sent o the table without any
errors. Its a big txt file, so it runs for a while, but it hangs up on
the double quotes. I don't suppose it will hang on the single quotes if
I change it?
Any suggestions??
Justin Fancy