Protected Sub btnUpdate_Click(sender As Object, e As System.EventArgs) Handles btnUpdate.Click
Try
UploadImg(FileUploadF, "F" & IDCode)
UploadImg(FileUploadB, "B" & IDCode)
UploadImg(FileUploadL, "L" & IDCode)
UploadImg(FileUploadR, "R" & IDCode)
UploadImg(FileUploadX, "X" & IDCode)
UploadImg(FileUploadY, "Y" & IDCode)
insert_path(IDCode)
Catch ex As Exception
Response.Write(ex.Message)
End Try
End Sub
Public Sub UploadImg(ByVal fUpload As FileUpload, ByVal strName As String)
Try
If (fUpload.HasFile) Then
Dim ToPath As String = Server.MapPath("P:/" & strName & ".jpg")
fUpload.SaveAs(ToPath)
End If
Catch ex As Exception
Response.Write(ex.Message)
End Try
End Sub
Public Sub insert_path(ByVal GoodCodeImg As String)
Dim ImgF As String = "F" & GoodCodeImg & ".jpg"
Dim ImgB As String = "B" & GoodCodeImg & ".jpg"
Dim ImgL As String = "L" & GoodCodeImg & ".jpg"
Dim ImgR As String = "R" & GoodCodeImg & ".jpg"
Dim ImgX As String = "X" & GoodCodeImg & ".jpg"
Dim ImgY As String = "Y" & GoodCodeImg & ".jpg"
Dim UpdateCommand As String = "UPDATE GoodPathPic WHERE GoodCode=@GoodCode and PicType=@PicType"
Try
Dim cmd As New SqlCommand(UpdateCommand, condb)
cmd.Parameters.AddWithValue("@GoodCode", GoodCodeImg)
cmd.Parameters.AddWithValue("@GoodPathPic", ImgF)
cmd.Parameters.AddWithValue("@GoodPathPic", ImgB)
cmd.Parameters.AddWithValue("@GoodPathPic", ImgL)
cmd.Parameters.AddWithValue("@GoodPathPic", ImgR)
cmd.Parameters.AddWithValue("@GoodPathPic", ImgX)
cmd.Parameters.AddWithValue("@GoodPathPic", ImgY)
cmd.ExecuteNonQuery()
Catch ex As Exception
Response.Write(ex.Message)
End Try