USUÁRIO:      SENHA:        SALVAR LOGIN ?    Adicione o VBWEB na sua lista de favoritos   Fale conosco 

 

  Fórum

  Visual Basic
Voltar
Autor Assunto:  [VB6][Dúvida] - Uso de Null
William Okano
não registrado
Postada em 29/05/2008 09:50 hs   
Galera, seguinte
1º Sou Cadastrado no fórum aqui e não consigo fazer o Login :P
 
2º Agora a Dúvida.
 
Tenho uma consulta que busca alguns valores de uma tabela access 2003, ocorre tudo bem se não fosse o maldito quando tem um campo vazio da invalid use o null, como posso depurar esse erro e quando encontrar um valor null ele retornar simplesmente vazio, mas não dar erro no código, aqui vai o código!
 
Private Function BuscaDados()
    flex.Rows = 1
    Dim cnnComando As New ADODB.Command
    Dim rsSelecao As New ADODB.Recordset
    With cnnComando
        .ActiveConnection = cnn
        .CommandType = adCmdText
        .CommandText =
     
Treze
Pontos: 2843 Pontos: 2843
SÃO VICENTE
SP - BRASIL
Postada em 29/05/2008 10:19 hs            
como você esta fazendo para exibir o resultado da pesquisa? coloca o código pra gente
 
     
William Okano
não registrado
Postada em 29/05/2008 15:28 hs   

Private Function BuscaDados()
    flex.Rows = 1
    Dim cnnComando As New ADODB.Command
    Dim rsSelecao As New ADODB.Recordset
    With cnnComando
        .ActiveConnection = cnn
        .CommandType = adCmdText
        .CommandText = "SELECT * FROM rel_servicos WHERE id_cliente = " & QRS & " ORDER BY data DESC;"
        Set rsSelecao = .Execute
    End With
    With rsSelecao
        If .BOF And .EOF Then
            flex.Rows = 1
        Else
            flex.Rows = 1
            Dim i As Integer
            i = 1
            .MoveMin
            Dim Tecnico As String
            Do Until .EOF
                If IsNull(Tecnico) Then
                    Tecnico = "---"
                Else
                    Tecnico = !Tecnico
                End If
                flex.Rows = flex.Rows + 1
                flex.TextMatrix(i, 0) = !id
                flex.TextMatrix(i, 1) = !Data
                flex.TextMatrix(i, 2) = !servico
                flex.TextMatrix(i, 3) = Tecnico
                .MoveNext
                i = i + 1
            Loop
        End If
    End With
    Set cnnComando = Nothing
    Set rsSelecao = Nothing
End Function

 

Foi mal galera,~não sei pq o código não foi completo

 
     
William Okano
não registrado
Postada em 29/05/2008 15:29 hs   

Private Function BuscaDados()
    flex.Rows = 1
    Dim cnnComando As New ADODB.Command
    Dim rsSelecao As New ADODB.Recordset
    With cnnComando
        .ActiveConnection = cnn
        .CommandType = adCmdText
        .CommandText = "SELECT * FROM rel_servicos WHERE id_cliente = " & QRS & " ORDER BY data DESC;"
        Set rsSelecao = .Execute
    End With
    With rsSelecao
        If .BOF And .EOF Then
            flex.Rows = 1
        Else
            flex.Rows = 1
            Dim i As Integer
            i = 1
            .MoveMin
            Dim Tecnico As String
            Do Until .EOF
                flex.Rows = flex.Rows + 1
                flex.TextMatrix(i, 0) = !id
                flex.TextMatrix(i, 1) = !Data
                flex.TextMatrix(i, 2) = !servico
                flex.TextMatrix(i, 3) = !Tecnico
                .MoveNext
                i = i + 1
            Loop
        End If
    End With
    Set cnnComando = Nothing
    Set rsSelecao = Nothing
End Function

 

eita, é esse!

 
     
Treze
Pontos: 2843 Pontos: 2843
SÃO VICENTE
SP - BRASIL
Postada em 29/05/2008 15:48 hs            
tenta isso colega
 
Bom colega uma solução simpls para isto é esta postada abaixo, faça as alterações conforme indicado e tente novamente.
 
                flex.Rows = flex.Rows + 1
                flex.TextMatrix(i, 0) = !id & ""
                flex.TextMatrix(i, 1) = !Data & ""
                flex.TextMatrix(i, 2) = !servico & ""
                flex.TextMatrix(i, 3) = !Tecnico & ""
     
José Ari
MANAUS
AM - BRASIL
ENUNCIADA !
Postada em 30/05/2008 23:13 hs            
Pow, o Treze sempre ajudando a galera... eh isso ae garoto... hehe

eu tinha esse mesmo problema, e acho que foi o Treze que me ajudou nessa com essa dica bem simples.....

================================================================
O Aprendizado é Direito de Todos. O Saber é Privilégio de Poucos.

Começando a estudar VB.NET. Realmente é incrível!!!!

   
Página(s): 1/2      PRÓXIMA »


Seu Nome:

Seu eMail:

ALTERAR PARA MODO HTML
Mensagem:

[:)] = 
[:P] = 
[:(] = 
[;)] = 

HTML DESLIGADO

     
 VOLTAR

  



CyberWEB Network Ltda.    © Copyright 2000-2025   -   Todos os direitos reservados.
Powered by HostingZone - A melhor hospedagem para seu site
Topo da página