Public Sub UpdateDocument(ByVal moduleId As Integer, ByVal itemId As Integer, ByVal userName As String, ByVal name As String, ByVal url As String, ByVal category As String, ByVal content() As Byte, ByVal size As Integer, ByVal contentType As String)
If userName.Length < 1 Then
userName = "unknown"
End If
' Create Instance of Connection and Command Object
Dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings("connectionString"))
Dim myCommand As New SqlCommand("Portal_UpdateDocument", myConnection)
myCommand.CommandType = CommandType.StoredProcedure
Dim parameterItemID As New SqlParameter("@ItemID", SqlDbType.Int, 4)
parameterItemID.Value = itemId
myCommand.Parameters.Add(parameterItemID)
Dim parameterModuleID As New SqlParameter("@ModuleID", SqlDbType.Int, 4)
parameterModuleID.Value = moduleId
myCommand.Parameters.Add(parameterModuleID)
Dim parameterUserName As New SqlParameter("@UserName", SqlDbType.NVarChar, 100)
parameterUserName.Value = userName
myCommand.Parameters.Add(parameterUserName)
Dim parameterName As New SqlParameter("@FileFriendlyName", SqlDbType.NVarChar, 150)
parameterName.Value = name
myCommand.Parameters.Add(parameterName)
Dim parameterFileUrl As New SqlParameter("@FileNameUrl", SqlDbType.NVarChar, 250)
parameterFileUrl.Value = url
myCommand.Parameters.Add(parameterFileUrl)
Dim parameterCategory As New SqlParameter("@Category", SqlDbType.NVarChar, 50)
parameterCategory.Value = category
myCommand.Parameters.Add(parameterCategory)
Dim parameterContent As New SqlParameter("@Content", SqlDbType.Image)
parameterContent.Value = content
myCommand.Parameters.Add(parameterContent)
Dim parameterContentType As New SqlParameter("@ContentType", SqlDbType.NVarChar, 50)
parameterContentType.Value = contentType
myCommand.Parameters.Add(parameterContentType)
Dim parameterContentSize As New SqlParameter("@ContentSize", SqlDbType.Int, 4)
parameterContentSize.Value = size
myCommand.Parameters.Add(parameterContentSize)
myConnection.Open()
myCommand.ExecuteNonQuery()
myConnection.Close()
End Sub