While searching a record in database it accepts all the letters and special characters.but,i enter Apostrophe it is showing error(Cannot perform 'Mod' operation on System.String and System.String) like this...how to clear this bug?

Showing Answers 1 - 4 of 4 Answers

Brijesh

  • Nov 28th, 2005
 

While searching a record in database it accepts

  Was this answer useful?  Yes

sivakesh

  • Nov 28th, 2005
 

convert Apostrophe to string ans add @ attribute in you C# code....

gte this in you stored procedure on SQL with in single cotes... ('abc')

example

string name = "sivakesh";

string criteria = @"Apostrophe" 

SqlCommand s = new SqlCommand(@"select * from table where [name]='"+name+"' and criteria = '"+ criteria +"'";

lines for..................Dataadapter to fill your datase or Datatable

  Was this answer useful?  Yes

praneetha

  • Feb 6th, 2006
 

Replace the single quote with doble quote and then enter that in to the database. for example dim str = hello' is the string to be inserted then str = replace(str, " ' ", " '' ")now you will not get the error and it is stored as hello'

  Was this answer useful?  Yes

thenibala

  • Mar 24th, 2006
 

Use Stored Procedure and set the required Parameters to execute which ever characters. here its not necessary to replace single quote to other character

Regards

Muruganandham C

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions