Problem with sending (') in string

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Jul 2009
Posts: 28
Reputation: Pankaj18 is an unknown quantity at this point 
Solved Threads: 0
Pankaj18 Pankaj18 is offline Offline
Light Poster

Problem with sending (') in string

 
0
  #1
Oct 22nd, 2009
Hi,

I have problem, i have designed a web page in asp.net 3.5. I have a TextBox and a button, the User is expected to write some comment in the TextBox. The TextBox can also have a comment pattern including a (') on the click of button the data in the TextBox will be inserted into SQL.

Now the problem is : as you know that if u insert something in Varchar it has to be enclosed in ('), but in above case due to (') in the string itself there will be an error

So, is there a way to insert the data in SQL.

Thanks
Pankaj
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 182
Reputation: Kusno is an unknown quantity at this point 
Solved Threads: 15
Kusno's Avatar
Kusno Kusno is offline Offline
Junior Poster
 
0
  #2
Oct 23rd, 2009
Using Stored Procedure

or

use my way, replace ' to `

  1. TextBox1.Text = Replace(TextBox1.Text,"'","`")
NEVER NEVER NEVER GIVE UP
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 295 | Replies: 1
Thread Tools Search this Thread



Tag cloud for ASP.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC