Link to home
Start Free TrialLog in
Avatar of ashraf_t
ashraf_t

asked on

Problem in "Insert into" with Foxpro database

Hi The next code generate error in adding to foxpro database alose it works fine in Access and sql server, i discovered that the problem is in the chr(10) [chr(0) & chr(39) do the same error] , is there any help to solve this:
Notes: I need chr(10 , 0 or 39) in the output string

dim st as string
st="Test1" & chr(10) & "Test2"
S = "insert into [table1]  (Field1,Field2) Values (1 , ' " &  st  & " ')"  
DBC.Execute S

Thanx a lot
Avatar of pradapkumar
pradapkumar

try this use chr(13) or vbCrLf instead of chr(10)

dim st as string
st="Test1" & chr(13) & "Test2"
S = "insert into [table1]  (Field1,Field2) Values (1 , ' " &  st  & " ')"  
DBC.Execute S

All the best.
Avatar of ashraf_t

ASKER

infact i mustnot change any charater because the string iam saving is output from a function i designed to encrypt the string
then try this

st="Test1" & "\" & chr(39) & "Test2"

am i adding new character"\" to the string, If so this will be not accepted
ASKER CERTIFIED SOLUTION
Avatar of pradapkumar
pradapkumar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I tried this but it raised error also , add to this even it works i still have the problem that i added the character "\" to the encrypted string....
so i think if there are another way to add the record without using the insert into.
in fact i tried the way Addnew it works in access and sql server but it gives error in foxpro
Thanx a lot
[infact i mustnot change any charater because the string iam saving is output from a function i designed to encrypt the string
]

If you designed the encryption, can you re-design the encryption so as to avoid the use of invalid characters?
:) infact the easiest way is to use another database type for this table instead of foxpro (Thanx to ADO) and this what i did this night , Thanx for your help
finally u conquered @};-