How to Insert < > in DB and reterive

riagarwal

New member
Joined
Apr 25, 2013
Messages
4
Programming Experience
1-3
I have a textbox which contains the following characters in the text <Division>. Now, if I try to insert the values, I get the error message. However if I remove <> and then insert it works fine.


Please help. I need to insert the following characters also in DB.

Thanks
 
As JB implies, if you use parameters with your SQL code then there should be no issue. To learn how, follow the Blog link in my signature and check out my post on Parameters In ADO.NET.
 
I am using SQL Server 2010 and to also, it is not evening getting to that point for the insert. It seems that there is a issue in the textbox itself. So, i wonder that I need to know how to parse < > in textbox.
As if I use blank <> it works, but when i put some text in the tag <text> then it throws error

[h=2]A potentially dangerous Request.Form value was detected from the client (txtTestComments="<hello>").[/h]
 
In the top line of the aspx file (not the .aspx.vb file) add this: ValidateRequest="false"
So it'll look something like this:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="YourFile.aspx.vb" Inherits="Project.Page" ValidateRequest="false" %>
 
Hello,

I added the code ValidateRequest="false" to my .aspx file (not .aspx.vb) but still I am getting the error messgae when i use <test>. However, if I use <> it works fine.

this is how my code looks now

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="AccountHomePage.aspx.vb" Inherits="AccountHomePage" ValidateRequest="false" %>
 
Back
Top