Code: Select all
loader.Connection = conn
loader.CreateColumns()
loader.Open()
ret = Me.TextBox1.Text
ret = ret.Replace("'", "''") ' ' -> ''
ret = ret.Replace("\", "\\") ' \ -> \\
ret = ret.Replace(vbLf, "\" & vbLf) ' Lf -> \Lf
ret = ret.Replace(vbCr, "\" & vbCr) ' Cr -> \Cr
ret = ret.Replace(vbCrLf, "\" & vbCr & "\" & vbLf) ' CrLf -> \Cr\Lf
pg_escape_string = ret
loader.SetValue("field1", pg_escape_string)
loader.NextRow()
loader.Close()
I have tried changing to \n\r and \012\015 but these are written into the data as is instead of being written as CrLf. I also tries various combinations trying E'string' but to no avail.
I do have a test program that will show off this issue if you would like it.