I have a insert inserting some stuff and for some odd reason 2 of my columns are getting inserted with extra spaces.
I have the strings .trim() but its not triming the insert. Oddly enough I am creating a directory on the fly using one of my same strings and its not creating the extra spaces when it does that.
String UserName = User.Identity.Name.Trim();
String OrgName = LabelOrg.Text.Trim();
String path = Server.MapPath("~/Uploads/Documents/" + OrgName + "/" + DropDownList1.SelectedValue + "/" + DropDownListDocType.SelectedValue + "/");
cmd.CommandText = "INSERT INTO tblDocuments (coopcode, locationid, doctypecode, docname, dateuploaded, docstorename, username) VALUES('" + OrgName + "','" + DropDownList1.SelectedValue + "','" + DropDownListDocType.SelectedValue + "','" + FileUpload1.FileName + "','" + DateTime.Now + "','" + dateString + "-" + FileUpload1.FileName + "','" + UserName + "')";
The coopcode and locationid is the ones adding extra spaces. I am using OrgName for the coopcode
Thanks in advance
View Complete Post