In my project, I export data from an excel spread sheet to the table in SQL database. And there are some fields in the excel spread sheet that has the comment ' character. And I need to traverse through each record check for a certain condiftion and add the filtered data to a different table with some custom calculations. But when I do this I get an error because of the comment character.
Ex: If the field content are : Dimention 12' X 14' , this gives an error message. Is there any way to ignore this, with out replacing the comment character? I need the character when I display the final report.
Any help is greatly appreciated.
HTMLEncode it, escape it or replace it. Depending on what you're actually doing, URLEncode may be better. Take a look at:
http://msdn2.microsoft.com/en-us/library/system.web.httpserverutility.urlencode(vs.71).aspx
http://msdn2.microsoft.com/en-us/library/system.web.httpserverutility.htmlencode(vs.71).aspx
http://aspnetresources.com/blog/encoding_forms.aspx
Jeff
Are you creating SQL strings to insert the data into the SQL tables?
If so then you need to make sure to replace the ' for a '' in the SQL string. Or you can create a parameterized command.
Thanks for all the replies. Much appreciated. I will try your suggesstions.
0 comments:
Post a Comment