Kode afvikles to gange?? Asp.net 2.0
Hej E.Når jeg tester min kode, så indsætter den to poster i min database.
Det er kun denne del som den løber igennem to gange.
Dim UploadImagesTabelAdapter As New dsFotoTableAdapters.tbl_ImageGalleryImagesTableAdapter
UploadImagesTabelAdapter.UploadImageByAlbumID(DropDownList1.SelectedValue, CurrentTime & fuLarge.FileName, CurrentTime & fuThumb.FileName, "", DateTime.Now)
Er her en som kan se hvorfor..
Det virker ellers fint nok.
Protected Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click
Dim CurrentTime As DateTime
CurrentTime = DateTime.Today
If fuThumb.HasFile And fuLarge.HasFile Then
If fuThumb.FileName = fuLarge.FileName Then
Try
fuThumb.SaveAs(Server.MapPath("~/ImageGallery/Thumb/" & CurrentTime & fuThumb.FileName))
fuLarge.SaveAs(Server.MapPath("~/ImageGallery/Large/" & CurrentTime & fuLarge.FileName))
Dim UploadImagesTabelAdapter As New dsFotoTableAdapters.tbl_ImageGalleryImagesTableAdapter
UploadImagesTabelAdapter.UploadImageByAlbumID(DropDownList1.SelectedValue, CurrentTime & fuLarge.FileName, CurrentTime & fuThumb.FileName, "", DateTime.Now)
Catch ex As Exception
lblError.Text = ex.ToString
End Try
Else
lblError.Text = "Ups. Begge filer skal have det samme navn..."
End If
Else
lblError.Text = "Ups. Du skal vælge begge filer"
End If
End Sub