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
ashraf_tAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pradapkumarCommented:
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.
ashraf_tAuthor Commented:
infact i mustnot change any charater because the string iam saving is output from a function i designed to encrypt the string
pradapkumarCommented:
then try this

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

Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

ashraf_tAuthor Commented:
am i adding new character"\" to the string, If so this will be not accepted
pradapkumarCommented:
if u give chr(39){which is the equalent of single quote} will terminate the string while u insert into the sql statement. To enable that to insert the engine needed that escape character so your querry would be

insert into emp (name,age) values('Kumar\'s',19);

if u give

insert into emp (name,age) values('Kumar's',19);
this will terminate the actual string value  ^   here.
So you need to give that escape character. otherwise it will raise error message.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ashraf_tAuthor Commented:
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
g_johnsonCommented:
[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?
ashraf_tAuthor Commented:
:) 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
pradapkumarCommented:
finally u conquered @};-
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.