1 2 3 4 5 6 7 8
| command.CommandText = "INSERT INTO TableImage(Image,Chemin,Taille,DateCreation,ContentType) values (@file_bytes,@Chemin,@Taille,@DateCreation,@ContentType)";
command.Parameters.Add("file_bytes", SqlDbType.VarBinary).Value = FileUpload1.FileBytes;
command.Parameters.Add("Chemin", SqlDbType.VarChar, 200).Value = FileUpload1.FileName;
command.Parameters.Add("Taille", SqlDbType.VarChar, 50).Value = FileUpload1.PostedFile.ContentLength;
command.Parameters.Add("DateCreation", SqlDbType.Date).Value = DateTime.Now;
command.Parameters.Add("ContentType", SqlDbType.VarChar, 50).Value = FileUpload1.PostedFile.ContentType;
command.ExecuteNonQuery(); |
Partager