Click to See Complete Forum and Search --> : Database


nitya
September 12th, 2001, 06:57 AM
I want to know whether character pipe(|) can be inserted into access database using vb.Becos when i am trying to insert a | its giving me a syntax error

Iouri
September 12th, 2001, 07:16 AM
Pipr can be inserted into the text field. make sure that you have quotes around it.

Iouri Boutchkine
iouri@hotsheet.com

nitya
September 12th, 2001, 08:09 AM
I have written Sql statement this way

strsql = "Insert into questionnaire (questionnaire_name) values ( " & "'" & str & "'" & " )"

and value of str="ssssssssss|"

which is giving me syntax error for |
if i remove | from the string its fine

Andrew_Fryer
September 12th, 2001, 08:21 AM
Hello,

try using the ascii representation of the pipe, i.e

str="ssssssssss"
strsql = "Insert into questionnaire (questionnaire_name) values ( " & "'" & str & "'" & chr(124) & "'" & "'" & " )"

Andrew

nitya
September 12th, 2001, 08:34 AM
no this is appendinding another | to it and giving an error

Andrew_Fryer
September 12th, 2001, 08:43 AM
Did you take the original one off the string first.

Use mid (str, 1, len(str) -1) & chr(124).

Failing that replace the | with another character that will not be used, such as \ or :, when it comes to reading them you can easily translate them back.

Andrew

jaimelopez
September 12th, 2001, 08:44 AM
hi!
I have just tried to insert a "|" with VB in Access (the way you suggested) and it works fine. Which kind of sintax error do you get, from the ODBC driver?
Jaime.