https://foro.gambas-es.org/viewtopic.php?f=3&t=5806&p=34493#p34493
-----------------------------------
v3ctor
Martes, 20 Septiembre 2016, 13:46

Re: Problema Con Consulta Sqlite Con La Letra ñ
-----------------------------------
muchas gracias por tu ayuda Grandamakulo

tema resuelto, dejo rutina para ejemplo....

[code linenumbers=false syntax=gambas]Public Sub FiltrarPersonasPorLetra(Letra As String) As Result
  Dim r As Result
  Dim sql, sql2, LetraMay, LetraMin, TildeMin, TildeMay As String
  Dim sqlLarga As Boolean
  
    LetraMay = UCase(Letra)
    LetraMin = String.LCase(Letra)
     
    Select Case Letra
      Case "A"
        TildeMin = "á"
        TildeMay = "Á"
        sqlLarga = True
      Case "E"
        TildeMin = "é"
        TildeMay = "É"
        sqlLarga = True
      Case "I"
        TildeMin = "í"
        TildeMay = "Í"
        sqlLarga = True 
      Case "O"
        TildeMin = "ó"
        TildeMay = "Ó"
        sqlLarga = True 
      Case "U"
        TildeMin = "ú"
        TildeMay = "Ú"
        sqlLarga = True 
      Case Else
        
    End Select
    
    If sqlLarga Then
      sql2 = "nombrePer like '&1%' or nombrePer like '&2%' or nombrePer like '&3%' or nombrePer like '&4%' order by nombrePer asc"
      sql = Subst("Select * from DatosPersonas where " & sql2, LetraMay, LetraMin, TildeMin, TildeMay) 
    Else
       sql = Subst("Select * from DatosPersonas where nombrePer like '&1%' or nombrePer like '&2%' order by nombrePer asc", LetraMay, LetraMin)
    Endif
  
    r = fPersonas.CX_personas.Coneccion.Exec(sql) 
          
    Return r
  
End[/code]


