Salvando Imagens no SQL


Author
Message
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Oi Luiz.

Desculpa, esqueci de te falar um detalhe.

Vá ao Business Object Mapper e customize o tipo deste campo. No BOM, click no BO que contém o seu campo no treeview do lado esquerdo, então dê um duplo click no seu campo fto_foto. Olhe a foto abaixo e faça o mesmo com o seu. Em seguida, não se esqueça de executar um Build Partial no seu BO e um Build no seu projeto no VS.


Luiz Aldo Miguel
Luiz Aldo Miguel
StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)
Group: Forum Members
Posts: 8, Visits: 54
Ola Ivan fiz oq vc pediu, da erro nessa linha

 Me.BussinesObject71.fto_foto = CType(loImage, System.Drawing.Bitmap),

parece que ele não consegue conter o tipo varbinary max

Error 4 Value of type 'System.Drawing.Bitmap' cannot be converted to '1-dimensional array of Byte'. C:\Users\user\Documents\Visual Studio 2008\Projects\Sp_Consult\Sp_Consult\frmfotoImovel.vb 25 48 Sp_Consult

Obrigado
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Olá Luiz.

Sim, você pode utilizar um VarBinary Max:



Em código, você pode criar algo do gênero para salvar sua imagem ao seu campo, no Click de um botão:

    Private Sub cmdLogotipo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLogotipo.Click
        '-- Establish locals
        Dim loDialog As New OpenFileDialog()
        Dim loImage As System.Drawing.Image

        '-- Set the properties on the form
        loDialog.Multiselect = False

        '-- Show the form
        If loDialog.ShowDialog = Windows.Forms.DialogResult.OK Then
            Try
                '-- Try to open the image
                loImage = System.Drawing.Image.FromFile(loDialog.FileName)

                '-- Set the image on the record
                Me.EmpresasBO1.emp_Logo = CType(loImage, System.Drawing.Bitmap)

                '-- Set the picture box as well
                Me.PictureBox1.Image = loImage
            Catch ex As Exception
            End Try
        End If
    End Sub

Luiz Aldo Miguel
Luiz Aldo Miguel
StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)
Group: Forum Members
Posts: 8, Visits: 54
Ola

Criei uma aplicação para salvar imagens no sqlserver ....

Tenho uma tabela simples dois campos , descricao da foto e a foto .

Qual tipo de campo no dabase deployment toolkit utilizo para salvar imagens. ?

Alguem ja fez isso usando o strata ?
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search