Hello,
Due to some hostingrestrictions I am obliged to use access as a database.
Everything goes well untill I get to the fileupload in chapter 13.
Apparantely a accessdatasource does not work with e.newobject very well.
Ctype(e.NewObject, Picture) is not a member of SqlDataSourceCommandEventArgs...
Code:
Protected Sub AccessDataSource2_Inserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceCommandEventArgs) Handles AccessDataSource2.Inserting
Dim mypicture As Picture = CType(e.NewObject, Picture)
Dim FileUpload1 As FileUpload = _
CType(ListView1.InsertItem.FindControl("FileUpload1"), FileUpload)
Dim virtualFolder As String = "~/pics/"
Dim physicalFolder As String = Server.MapPath(virtualFolder)
Dim fileName As String = Guid.NewGuid().ToString()
Dim extension As String = System.IO.Path.GetExtension(FileUpload1.FileName)
FileUpload1.SaveAs(System.IO.Path.Combine(physicalFolder, fileName + extension))
mypicture.ImageUrl = virtualFolder + fileName + extension
End Sub
Help is very much appriciated