Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    [VB6] - Problema Query con ADO

    Ho un problema con una query facile ..

    codice:
    Public SQLQuery As String
    Public DBConn As ADODB.Connection
    Public RecSet As ADODB.Recordset
    
    Private Sub Command1_Click()
     Dim St As String
     Set DBConn = New ADODB.Connection
     Set RecSet = New ADODB.Recordset
     DBConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='C:\AerreDb.mdb';Persist Security Info=False"
     DBConn.Open DBConn.ConnectionString
     
     RecSet.Open SQLQuery, DBConn, 1
     Form1.Caption = RecSet.RecordCount & " Record "
     
     List1.Clear
     If RecSet.RecordCount > 0 Then
      RecSet.MoveFirst
      While RecSet.EOF = False
       St = ""
       For i = 0 To RecSet.Fields.Count - 1
        St = St & " " & RecSet.Fields(i).Value
       Next i
       List1.AddItem St
       RecSet.MoveNext
     Wend
     End If
    End Sub
    
    Private Sub Form_Load()
     SQLQuery = "SELECT C.Nome FROM CLIENTE AS C WHERE C.Nome like '*MARCO*' "
     Command1.Caption = "Esegui query : " & SQLQuery
    End Sub
    Nom mi restituisce nessun record anche se nella tabella ci sono diversi record contenenti nel campo nome Marco.
    Please HELP me !

  2. #2
    Utente di HTML.it L'avatar di Sypher
    Registrato dal
    Jun 2003
    Messaggi
    1,994
    se al posto degli asterischi ci metti il percentuale(%)?

    poi in che fourm hai postato?
    La passera non dura perchè Sypher la cattura!

    "No one like us we don't care, we are millwall, super millwall, we are millwall from the DEN"

  3. #3
    Utente di HTML.it L'avatar di Jupy64
    Registrato dal
    Sep 2004
    Messaggi
    1,151

    Re: [VB6] - Problema Query con ADO

    Originariamente inviato da lecora_marco
    Ho un problema con una query facile ..

    codice:
    Public SQLQuery As String
    Public DBConn As ADODB.Connection
    Public RecSet As ADODB.Recordset
    
    Private Sub Command1_Click()
     Dim St As String
     Set DBConn = New ADODB.Connection
     Set RecSet = New ADODB.Recordset
     DBConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='C:\AerreDb.mdb';Persist Security Info=False"
     DBConn.Open DBConn.ConnectionString
     
     RecSet.Open SQLQuery, DBConn, 1
     Form1.Caption = RecSet.RecordCount & " Record "
     
     List1.Clear
     If RecSet.RecordCount > 0 Then
      RecSet.MoveFirst
      While RecSet.EOF = False
       St = ""
       For i = 0 To RecSet.Fields.Count - 1
        St = St & " " & RecSet.Fields(i).Value
       Next i
       List1.AddItem St
       RecSet.MoveNext
     Wend
     End If
    End Sub
    
    Private Sub Form_Load()
     SQLQuery = "SELECT C.Nome FROM CLIENTE AS C WHERE C.Nome like '*MARCO*' "
     Command1.Caption = "Esegui query : " & SQLQuery
    End Sub
    Nom mi restituisce nessun record anche se nella tabella ci sono diversi record contenenti nel campo nome Marco.
    Please HELP me !
    ciao, fai attenzione, se nella tabella il nome è scritto Marco e tu lo ricerchi tutto in maiuscolo (MARCO) non troverai mai niente!!!
    eventualmente dovresti modificare la query cosi:
    "...WHERE UCase(C.Nome) like '*MARCO*';"
    Jupy

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.