Go to DotNetFunda.com
 Online : 1211 |  Welcome, Guest!   Login
 
Home > Forums > C# > how to add double quotation to string using C# ...

C# Forum



how to add double quotation to string using C#

Author: Lokeshbasana | Posted on: 7/1/2009 | Category: C# | Views: 991 | Level: Starter | Status: [Member] |

string query = "select OrderCode,OrderDesc,to_date(OrderDate,'dd-MON-YYYY') As "OrderDate" from tblOrder";

//getting Error to the above string how to add double quotation to my OrderDate string

while debuging the string must look like

select OrderCode,OrderDesc,to_date(OrderDate,'dd-MON-YYYY') As "OrderDate" from tblOrder

thanks


Reply

Interesting?   Share and Bookmark this

 Responses

Raja  
Posted on: 7/1/2009 8:49:21 AM
Level: Starter | Status: [Member] | Reply

use \ (backslash) escape character to do that.

For example, your string should look like

string query = "select OrderCode,OrderDesc,to_date(OrderDate,'dd-MON-YYYY') As \"OrderDate\" from tblOrder"; 



Thanks


Regards,
Raja

Lokeshbasana, please login to Mark As Answer, if this helps | Alert Moderator 

Vuyiswamb  
Posted on: 7/1/2009 9:26:56 AM
Level: HonoraryPlatinum | Status: [Member] [Administrator] | Reply

Good Evening Lokeshbasana

Change it this way

string query = "select OrderCode,OrderDesc,to_date(OrderDate,'dd-MON-YYYY') as [ OrderDate]  from tblOrder";




as you can see above i have used Brackets. that is how you should do it in SQL.

Thank you for Posting at Dotnetfunda

Vuyiswa Maseko

Lokeshbasana, please login to Mark As Answer, if this helps | Alert Moderator 

Raja  
Posted on: 7/2/2009 11:47:10 AM
Level: Starter | Status: [Member] | Reply

Vuyiswamb,

I think his question is not how the query should look like but he wants " (double quote) to appear in the string so I guess the solution I provided is correct.

Thanks


Regards,
Raja

Lokeshbasana, please login to Mark As Answer, if this helps | Alert Moderator 

Latest Posts

More ... 

 Write New Post


Advertisement

About Us | The Team | Advertise | Contact Us | Feedback | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you found copied contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
All rights reserved to DotNetFunda.Com. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks.
(Best viewed in IE 6.0+ or Firefox 2.0+ at 1024 * 768 or higher)