How To Insert Single Quote Into DB2

If you try to insert single quote into DB2 sql table directly, it will give an error message due to single quote is reserved for mark a string value in sql. It is not allowed to use escape sequence for single quote with sql. Below example is incorrect with sql syntax.

INSERT INTO CUSTOMERS ( COMPANY_NAME ) VALUES ('Nandun\'s Company')

Here middle single quote is not valid even it has used the escape sequence. The easiest method to insert single quote into sql table is replace single quote with double quote.

INSERT INTO CUSTOMERS ( COMPANY_NAME ) VALUES ('Nandun\"s Company')

In second example I have replaced the single quote with double quote, but once you execute this command it will insert single quote instead of double quote.

You can use following code in C#.NET to replace single quote with double quote.

Replace("\'", "\"")

If you have any question you can list them under comments section.

Crystal Report Toolbar Images Not Displayed In ASP.NET

If you have used Crystal Report (Crystal Reports 2008 Official Guide) with Microsoft ASP.NET, you might have face this issue many times. This is a common problem with Crystal Report deployment and many people don't have proper solution for the problem. Crystal Report Toolbar images not shown in deployed environment is one of the main inconvenient with the tool that is leaded many developers not to use Crystal Report tool as their reporting tool even though Microsoft Visual Studio distribute Business Objects Crystal Report Tools free of charge. Even though your report is perfectly working inside the report viewer, it is not useful if the report viewers toolbar is not working properly. You can not navigate through multiple pages, can not export your report, can not print the report...etc. So that it is equally important to work your report and report viewer both correctly to feel end user happy reporting experience.

LinkWithin

Related Posts with Thumbnails

Twitter Updates

    follow me on Twitter