Hi, All
In my trusty VB6, i would use some simple SQL to update a data grid as the user types into a text box, somthing like :
Public Sub SalesSearchproductsquery1()
Dim andrequired As Integer
'called on the lost focus of the search text boxes
'Build the search critera
andrequired = False
gsqlstr = ""
gsqlstr = "Select * from productstbl "
'Build where only if something has been entered
If Len(SerchItemCode1_txt & SerchSuppCode1_txt & SerchSuppName1_txt & SerchDiscript1_txt) > 0 Then
gsqlstr = gsqlstr & " where "
End If
If Len(SerchItemCode1_txt) > 0 Then
If UseLikeSearch Then 'use like then
gsqlstr = gsqlstr & "ITEMCODE like " & "'*" & SerchItemCode1_txt & "*'"
Else
gsqlstr = gsqlstr & "ITEMCODE = " & "'" & SerchItemCode1_txt & "'"
End If
andrequired = True
End If
Data1.RecordSource = gsqlstr
Data1.Refresh
So, on every key event (key up/Key down) the list from the recordset gets smaller.
If I trey somthing similar in ado.net all records vanish, only to re-emerge if a complete
match is found in the recordset.
That can't be right
All that with a speed panelty.
(Wasted so much money on VS 2005 pro, just to find that VB6 is running rings around around VS2005) ![]()
Any one, got some clue how to improve this sort of code
best regards
Mike(Mobo_man)

search a database
Liel
If you just need to distinguish Like and = by one field SerchItemCode1_txt only,
I suggest just create two query in the dataset, Fillby like and Fillbyequal,
then 'called on the lost focus of the search text boxes,
However, if more than one field , I still think VB6 style code is my most favourite