" select CategoryName from Categories where CategoryName like 'E*'"
>>" select CategoryName from Categories where CategoryName = 'Electronic'"
>>sRecVal = oReader.GetValue(0)
>>>> >> Private Function DoSearch(ByVal sChar As String) As Boolean >> >> 'The TextBox.KeyPress passes in the value e.KeyChar.ToString() >> >> ' Define variables >> Dim sRecVal As String = "" ' Variable to hold the value of the record >> Dim sSQLCommand As String = "" ' The SQL Command >> Dim sTextVal As String = "" ' The contents of the textbox >> Dim oCommand As OleDbCommand ' The command object >> Dim oReader As OleDbDataReader ' The data reader object >> >> ' Get the value of the textbox, removing any leading or trailing spaces >> ' including the last character typed. The value sChar was passed in >> ' from the KeyPress event >> sTextVal = txtText.Text.Trim() & sChar >> >> ' Form the SQL command >> sSQLCommand = " select " & _sSearchField & _ >> " from " & _sSearchAlias & _ >> " where " & _sSearchField & " like '" & _ >> sTextVal & "*'" >> >> ' Create the command object, passing the SQL quert string and a reference >> ' to the connection object >> oCommand = New OleDbCommand(sSQLCommand, _oConnection) >> >> ' Execute the command to get the data >> oReader = oCommand.ExecuteReader() >> >> ' Read in the data. Only need the first occurance of the string >> oReader.Read() >> sRecVal = oReader.GetValue(0) >> >> If sRecVal <> "" Then >> >> txtText.Text = sRecVal >> >> End If >> >> End Function >>