User-371148474 posted
I've been updating forms for quite a while now, I just can't get a hold of this, There is this form that Updates a nvarchar field in the database, But after updating, It returns result with a comma appended to the last letter, I took it to another test scenario,
spacing the letters, I found out after it turns some empty spaces to commas..
E.g
Culoe De Song, But I intended to have Culoe De Song
here is my code
if(IsPost && Request["fname"]!=null){
var saved= "UPDATE UserProfile SET FName=@0 WHERE UserID=@1";
db.Execute(saved,Request["fname"],WebSecurity.GetUserId(WebSecurity.CurrentUserName));
string currentUrl = Request.Url.LocalPath;
Response.Redirect(currentUrl);
}
<form action="" method="post">
<div class="col-sm-9" style="margin-left:-15px;font-size: 11px;">
<input type="text" class="form-control" name="fname" value="@user.Fname">
</div>
<div class=" col-sm-2" style="margin-right:-20px;font-size: 11px;">
<button style="font-size: 11px;" class='btn btn-default btn-round-sm btn-sm del' type='submit' name="fname">Save</button>
</div>
</form>
Note: @user.Fname is reading the existing value from the database.
HOw do I get rid of the commas appending themselves to the updated field.