質問

have a code snippet:

  Dim lres As New List(Of DataAttribute)

        If irequest.Param("letter").Value IsNot Nothing Then

 Dim letter As String = "A"
            If irequest.Param.Contains("letter") Then
                Integer.TryParse(irequest.Param("letter").Value, letter)
            End If

            Dim ltable = DataProvider.GetDataTable(Nothing, lres, "USERS", "ORDER BY `Lastname` ASC LIMIT " & letter)

but here struggeling: Lastname` ASC LIMIT " & letter)

want to get data started with A or whatever selected in alphabetical menu.

how to write right LIMIT for Letters??

役に立ちましたか?

解決

want to get data started with A or whatever selected

You do that with a WHERE clause, not with LIMIT:

WHERE LastName LIKE 'A%'

This will give you only names that start with an 'A'. What you need to do to create an sql statement like that depends on your dataprovider, which you have not shown to us.

他のヒント

I think you are trying to sort a list and return all the strings beginning with some letter and letters occurring later in the alphabet.

Not sure about sqlite, but in MSSQL you can just use greater than, less than:

WHERE Lastname >= 'f' ORDER BY Lastname

will get you the ordered list and only words beginning with f through z.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top