DO CASE REGISTROS COM IMAGEM FORA DO BANCO

MARCELOFAZAN 31/05/2010 15:02:46
#343415
sera que pra funcionar a foto dentro do case do botao


teria que colocar algo assim

Dim rs As New ADODB.Recordset

Select Case Index
Case 0 [ô] primeiro
Sql = [Ô]SELECT * FROM buscar [Ô] _
& [Ô]WHERE id IN (SELECT MIN(id) FROM buscar)[Ô]

If Dir(App.Path & [Ô]\[Ô] & txtid.Text & [Ô].jpg[Ô]) < > [Ô][Ô] Then
Picture1.Picture = LoadPicture(App.Path & [Ô]\[Ô] & txtid.Text & [Ô].jpg[Ô])
Else
Msgbox [Ô]Arquivo não existe![Ô]
End If

Case 1 [ô] anterior
Sql = [Ô]SELECT TOP 1 * FROM buscar [Ô] _
& [Ô]WHERE id < [Ô] & Val(txtid.Text) & [Ô] ORDER BY id DESC[Ô]

If Dir(App.Path & [Ô]\[Ô] & txtid.Text & [Ô].jpg[Ô]) < > [Ô][Ô] Then
Picture1.Picture = LoadPicture(App.Path & [Ô]\[Ô] & txtid.Text & [Ô].jpg[Ô])
Else
Msgbox [Ô]Arquivo não existe![Ô]
End If

Case 2 [ô] proximo
Sql = [Ô]SELECT TOP 1 * FROM buscar [Ô] _
& [Ô]WHERE id > [Ô] & Val(txtid.Text) & [Ô] ORDER BY id[Ô]

If Dir(App.Path & [Ô]\[Ô] & txtid.Text & [Ô].jpg[Ô]) < > [Ô][Ô] Then
Picture1.Picture = LoadPicture(App.Path & [Ô]\[Ô] & txtid.Text & [Ô].jpg[Ô])
Else
Msgbox [Ô]Arquivo não existe![Ô]
End If

Case 3 [ô] ultimo
Sql = [Ô]SELECT * FROM buscar [Ô] _
& [Ô]WHERE id IN (SELECT MAX(id) FROM buscar)[Ô]

If Dir(App.Path & [Ô]\[Ô] & txtid.Text & [Ô].jpg[Ô]) < > [Ô][Ô] Then
Picture1.Picture = LoadPicture(App.Path & [Ô]\[Ô] & txtid.Text & [Ô].jpg[Ô])
Else
Msgbox [Ô]Arquivo não existe![Ô]
End If
End Select
MARCELO.TREZE 31/05/2010 15:26:33
#343422
Resposta escolhida
na realidade vc deve buscar o caminho dentro do banco assim:

teria que colocar algo assim

Dim rs As New ADODB.Recordset

Select Case Index
Case 0 [ô] primeiro
Sql = [Ô]SELECT * FROM buscar [Ô] _
& [Ô]WHERE id IN (SELECT MIN(id) FROM buscar)[Ô]

Case 1 [ô] anterior
Sql = [Ô]SELECT TOP 1 * FROM buscar [Ô] _
& [Ô]WHERE id < [Ô] & Val(txtid.Text) & [Ô] ORDER BY id DESC[Ô]

Case 2 [ô] proximo
Sql = [Ô]SELECT TOP 1 * FROM buscar [Ô] _
& [Ô]WHERE id > [Ô] & Val(txtid.Text) & [Ô] ORDER BY id[Ô]

Case 3 [ô] ultimo
Sql = [Ô]SELECT * FROM buscar [Ô] _
& [Ô]WHERE id IN (SELECT MAX(id) FROM buscar)[Ô]

End Select

Set Rs = Conexao Execute(Sql)

If RS!foto < > [Ô][Ô] Then
Picture1.Picture = LoadPicture(RS!foto)
Else
Msgbox [Ô]Arquivo não existe![Ô]
End If



lógico troque o RS!foto pelo no do campo que guarda o caminho da foto
MARCELOFAZAN 01/06/2010 12:54:46
#343531
Muito Obrigado Marcelo
me ajudo bastante valew


Private Sub CmdMov_Click(Index As Integer)
Dim rs As New ADODB.Recordset

Select Case Index
Case 0 [ô] primeiro
Sql = [Ô]SELECT * FROM buscar [Ô] _
& [Ô]WHERE id IN (SELECT MIN(id) FROM buscar)[Ô]

Case 1 [ô] anterior
Sql = [Ô]SELECT TOP 1 * FROM buscar [Ô] _
& [Ô]WHERE id < [Ô] & Val(txtid.Text) & [Ô] ORDER BY id DESC[Ô]

Case 2 [ô] proximo
Sql = [Ô]SELECT TOP 1 * FROM buscar [Ô] _
& [Ô]WHERE id > [Ô] & Val(txtid.Text) & [Ô] ORDER BY id[Ô]

Case 3 [ô] ultimo
Sql = [Ô]SELECT * FROM buscar [Ô] _
& [Ô]WHERE id IN (SELECT MAX(id) FROM buscar)[Ô]

End Select
rs.Open Sql, conexao

If Dir(App.Path & [Ô]\FOTOS\[Ô] & txtid & [Ô].bmp[Ô]) <> [Ô][Ô] Then
Picture1.Picture = LoadPicture(App.Path & [Ô]\FOTOS\[Ô] & txtid & [Ô].bmp[Ô])
Else
Picture1.Picture = LoadPicture([Ô][Ô])
End If

[ô]--------------------
If rs.EOF Then [ô] se nao encontrou

Else
MostraDados rs
End If

rs.Close: Set rs = Nothing

End Sub
Tópico encerrado , respostas não são mais permitidas