Prefix @ Symbol to TextBox value when inserting to Database in ASP.Net

micah
 
on Mar 22, 2018 12:32 AM
1221 Views

How do i let user insert text and it will insert with @ symbol, for example if i insert mic in textbox when it enters table it appears olike this @mic'

 

 <asp:TextBox ID="txtname" runat="server"></asp:TextBox>
 <asp:LinkButton ID="LinkButton1" runat="server">submit</asp:LinkButton>

 

Download FREE API for Word, Excel and PDF in ASP.Net: Download
nagaraju60
 
on Mar 22, 2018 02:48 AM
micah says:

if i add the @ symbol as you gave the example nothing is inserted into table

 in my sample code its working fine. please check your code or else you pass the textbox value in to string and pass the string value in to cmd parameter.

 

 

string UsrNm = "@" + txtUserName.Text.Trim();

cmd.Parameters.AddWithValue("@UserName",UsrNm);