Ciao a tutti, quando carico un file che contiene spazi, trattini... l'upload avviene correttamente, ma il salvataggio del nome del file nel DB mi da un errore:
string or binary data would be truncated. The statement has been terminated
perchè??
upload
codice:if (System.IO.File.Exists(path) == true) { nomefile = "copia_"+strFileNameOnServer; ((HtmlInputFile)(E.Item.FindControl("File1"))).PostedFile.SaveAs(strBaseLocation+nomefile); } else { nomefile = strFileNameOnServer; // nomefile = strFileNameOnServer + " - " + DateTime.Now.ToString(); ((HtmlInputFile)(E.Item.FindControl("File1"))).PostedFile.SaveAs(strBaseLocation+strFileNameOnServer); }
salvataggio
codice:myCommand.Parameters.Add(new SqlParameter("@Documento1", nomefile));

Rispondi quotando