【发布时间】:2017-07-16 06:39:37
【问题描述】:
我创建了一个 SQLite 数据库,但问题是当键入它时会阻塞,我没有得到任何数据并离开应用程序。这是我第一次使用数据库。我粘贴了一个代码片段。
Public NotInheritable Class METARTAF
Inherits Page
Dim dbpath As String
Dim conn As SQLiteConnection
Public Sub New()
' This call is required by the designer.
InitializeComponent()
'Ubicación de la base de datos
dbpath = Path.Combine(ApplicationData.Current.LocalFolder.Path, "airportsdb.sqlite3")
'Conexión a la base de datos
conn = New SQLiteConnection(New WinRT.SQLitePlatformWinRT(), dbpath)
End Sub
Private Sub AutoSuggestBox_TextChanged(sender As AutoSuggestBox, args As AutoSuggestBoxTextChangedEventArgs)
Dim result = conn.Query(Of airports)("select * from airports where name ").FirstOrDefault()
If args.Reason = AutoSuggestionBoxTextChangeReason.UserInput Then
If sender.Text.Length > 1 Then
sender.ItemsSource = result
End If
Else
sender.ItemsSource = "No results..."
End If
End Sub
【问题讨论】:
标签: sqlite uwp windows-phone autosuggest