Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send parameter with accentuation c#

Tags:

c#

.net

asp.net

I have an page and in my Send event, I need pass as a parameter an value "Name". But this name have accentuation and, in example for name "Raúl Lozada" sends "Raúl Lozada" to my procedure parameter. How I can correct it? In my HTML page, it loads correctly!

<asp:BoundField DataField="User" HeaderText="User" />    

SqlParameter myParam4 = oCommand.Parameters.Add("@User", SqlDbType.NChar);
            myParam4.Value = row.Cells[0].Text;
like image 520
CaioVJesus89 Avatar asked Oct 22 '22 05:10

CaioVJesus89


1 Answers

You need to HTML unescape the string, before sending to the DB:

Use HttpUtility.HtmlDecode:

myParam4.Value = HttpUtility.HtmlDecode(row.Cells[0].Text);
like image 154
Oded Avatar answered Nov 03 '22 21:11

Oded