diff --git a/comp/src/gb.db.form/.src/DataTable.class b/comp/src/gb.db.form/.src/DataTable.class index 35c95a9d6..f74698c98 100644 --- a/comp/src/gb.db.form/.src/DataTable.class +++ b/comp/src/gb.db.form/.src/DataTable.class @@ -167,17 +167,10 @@ End Public Sub Find(sWhere As String, Optional iFrom As Integer) As Integer Dim sReq As String - Dim aSort As String[] - Dim I As Integer Dim sSelect As String Dim rFind As Result - aSort = GetSortKeys().Copy() - For I = 0 To aSort.Max - aSort[I] = $DB.Quote(aSort[I]) - Next - - sSelect = "ROW_NUMBER() OVER (ORDER BY " & aSort.Join() & ") AS __index" + sSelect = "ROW_NUMBER() OVER (" & $DB.SQL.OrderBy(GetSortKeys())() & ") AS __index" sReq = $DB.SQL.Select([sSelect, "*"]).From($sTable).Where($sFilter)() sReq = "SELECT * FROM (" & sReq & ") WHERE " & sWhere diff --git a/comp/src/gb.db.form/.src/DataView.class b/comp/src/gb.db.form/.src/DataView.class index 92a8e1048..50690bb84 100644 --- a/comp/src/gb.db.form/.src/DataView.class +++ b/comp/src/gb.db.form/.src/DataView.class @@ -275,7 +275,6 @@ Public Sub Update() End - Private Function Columns_Read() As String[] Return $aColumns.Copy() @@ -804,10 +803,7 @@ End Public Sub MoveNext() - If $bCreate Then - MoveFirst - Return - Endif + If $bCreate Then Return If $hCtrl.Row >= $hCtrl.Rows.Max Then Return If $hCtrl.Row < 0 Then Return Inc $hCtrl.Row @@ -818,7 +814,7 @@ End Public Sub MovePrevious() If $bCreate Then - MoveFirst + MoveLast Return Endif If $hCtrl.Row <= 0 Then Return @@ -829,6 +825,8 @@ End Public Sub MoveTo(Index As Integer) + If Index = Index_Read() Then Return + If $bCreate Then $hCtrl.Row = -1 SetCreate(False) $hCtrl.Row = Index $hCtrl.Rows[$hCtrl.Row].Selected = True