Insert data to DB2 database using VB and SQL stored procedure

15080 pts.
Tags:
AS/400
IBM iSeries
Microsoft SQL Server 2000
SQL
VB.NET
I have spent a few days trying to find a solution using Google. Has anyone had luck with this problem? Simply put we are trying to send data from our web service to our I-Series. We need to do this via a SQL stored procedure. When we do the insert dynamically it works as long as there are no single quotes in the data. If someone has a name like Dave's Plumbing it blows up. We can do a replace of the char like this. dr("SoldToCompany") = dr("SoldToCompany").replace(Chr(39), " ") But the data is not "really" correct. The name is now Dave s Plumbing. Is there a way to keep the single quote doing it dynamically? Or has anyone found a better method? Any suggestions would be great.

Software/Hardware used:
sql server 2000, i-series

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • philpl1jb

    Try sending two single quotes instead of one.

    The 400 sees a single quote as ending a string .. but two single quotes as a literal single quote.

    50,860 pointsBadges:
    report
  • ToddN2000

    Tried your suggestion replacing with 2 single quotes, it worked!! Thanks.

    dr("SoldToCompany") = dr("SoldToCompany").replace(Chr(39), "''").

    15,080 pointsBadges:
    report
  • carlosdl
    Yep, one single quote works as a escape character for the other one.
    70,200 pointsBadges:
    report
  • philpl1jb

    Thanks for responding Todd.

    "I had intended to have gone into Africa incognito. But the fact that a white man, even an American, was about to enter Africa was soon known all over Zanzibar."

    Henry Morton Stanley


     

    50,860 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following