简体   繁体   中英

Upload Image to Database From DetailsView Insert Mode

I am attempting to upload an image to a database via a DetailsView containing an UploadFile control in the Edit Item template.

I have a stored procedure which handles the upload to a SQLServer DB which expects two parameters: AuthorName, varchar(20) and AuthorImage, varbin(20).

The DetailsView is associated with a SQLDataSource: Authors. The Authors data source has the stored procedure as the Insert Command.

I can grab the binary data from the UploadFile control during the ItemInserting event but I am at a loss as to how to attach the byte array to the AuthorImage parameter.

Any and all assistance appreciated and if possible answers in C# please.

On asp.net you can find the "Personal Site Starter Kit" who handles your problem. You can find it on asp.net

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM