Protected Sub btnSaveImageSet1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
' Store the fields into the WebImage.Tag property
Me.ILoad_MultipleImages1.SaveFieldValuesIntoWebImageTags()
'----------------------save images to database
' Save values to DB
Dim imageId As String = MyDemoImageId
Using connection As SqlConnection = Director.GetNewOpenDbConnection()
'Using connection As OleDbConnection = Director.GetNewOpenDbConnection()
'ILoadASCX.MultipleImages.ILoad_MultipleImages_Helper.SaveValuesToDB(Me.ILoad_MultipleImages1.Values, connection, Me.ILoad_MultipleImages1.ILoad.Configuration.InternalCode, imageId)
Me.ILoad_MultipleImages1.SaveValuesToDB(connection, imageId)
End Using
Me.ClientScript.RegisterStartupScript(Me.GetType(), "btnSaveImageSet1_Click", "alert(""" + Me.ILoad_MultipleImages1.Values.Count.ToString() + " image(s) saved..."");", True)
Using command1 As SqlCommand = DirectCast(e.Command.Connection.CreateCommand(), SqlCommand)
command1.CommandType = CommandType.Text
command1.CommandText = "INSERT INTO [CustomerImages] ([UserId],[EquipmentID], [Title], [ImageData], [MIMEType],[ImageId]) SELECT DISTINCT Equipment.[UserId], Equipment.[EquipmentID],[Example_E_204__Records].[Title],[ImageBytes],[MIMEType],[ImageId] FROM Equipment, [Radactive_ILoad_Images], Example_E_204__Records WHERE Equipment.ID = (SELECT MAX(Equipment.ID) FROM Equipment) AND [ConfigurationInternalCode] = 'Ex_E_204_ILoad1' AND ResizeInternalCode = 'Thumb1' AND ImageId = (SELECT MAX(ImageId) FROM Radactive_ILoad_Images) AND [Example_E_204__Records].[id] = (SELECT MAX(Id) FROM Example_E_204__Records)"
command1.ExecuteNonQuery()
End Using
End Sub
|