Hi, I'm trying to use the autocomplete feature to populate a dropdownlist with permit numbers from a database. I'm using the Winforms controls and Visual Studio. Instead of permit numbers appearing in the list I keep getting the following string: "System.Data.Common.DataRecordInternal" Here is the code I'm using to pull the data:
Private Sub txtProjectNumber_TextChanged(sender As Object, e As EventArgs) Handles txtProjectNumber.TextChanged
If txtProjectNumber.Text.Length >= 7 Then
Dim SQLConnect As New SQLite.SQLiteConnection
Dim SQLCommand As New SQLite.SQLiteCommand
Dim SQLReader As SQLite.SQLiteDataReader = Nothing
Dim strSQL As String = ""
SQLConnect.ConnectionString = DataAccess.sqliteConnString
SQLConnect.Open()
SQLCommand = SQLConnect.CreateCommand
Dim autoCompleteProjectNumber As New AutoCompleteStringCollection
strSQL = "select distinct JobSiteNo from Projects "
strSQL = strSQL & "where modulename NOT in ('clrkdata','licndata' ,'stckdata') "
strSQL = strSQL & "and placenameprefix = '" & CommonCalls.GetCurrentPNP & "' "
strSQL = strSQL & "and JobSiteNo not like 'BHP%' "
strSQL = strSQL & "and JobSiteNo like " & MakeSafeSQL(txtProjectNumber.Text, True) & " "
strSQL = strSQL & "order by JobSiteNo"
SQLCommand.CommandType = CommandType.Text
SQLCommand.CommandText = strSQL
SQLReader = SQLCommand.ExecuteReader()
txtProjectNumber.DataSource = SQLReader
txtProjectNumber.AutoCompleteMode = AutoCompleteMode.Suggest
txtProjectNumber.AutoCompleteDataSource = autoCompleteProjectNumber
SQLConnect.Close()
End If
End Sub
Does anyone know what I'm doing wrong here? I've checked bunch of forums but the fixes I've found don't work.
Thanks in Advance!!