General discussion

Locked

RecordSet Filter

By setivi ·
I populate a Datalist object with customerid
field from an ADO Recordset.
And, I have a VB6 script to filter the recordset:
datCustomer.Recordset.Filter _ = "customerId Like 'B%'"
This code just positions the cursor at the first occurence ofthe customerid beginning with the letter B. The result set coexists with customerids beginning with other letters other than B. How do I achieve having all Bs only showing in the Datalist?

This conversation is currently closed to new comments.

7 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

RecordSet Filter

by andrew In reply to RecordSet Filter

Are you sure? Filter show only matching records, but Find does what you're talking about.

This code worked properly for me:

Dim oCon As ADODB.Connection
Dim oRs As ADODB.Recordset

Set oCon = New ADODB.Connection
oCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\Microsoft Visual Studio\VB98\Biblio.mdb;"
Set oRs = New ADODB.Recordset
oRs.Open "select Author from Authors", oCon
oRs.Filter = "Author like 'B%'"
Do
List1.AddItem oRs!Author
oRs.MoveNext
Loop Until oRs.EOF

Collapse -

RecordSet Filter

by setivi In reply to RecordSet Filter

The solution needed was for Datalist and not listbox

Collapse -

RecordSet Filter

by andrew In reply to RecordSet Filter

I provided the ADO logic you needed.

Once you have the proper result set, you can use it anyway you like.

Collapse -

RecordSet Filter

by setivi In reply to RecordSet Filter

The question was auto-closed by TechRepublic

Collapse -

RecordSet Filter

by stefano In reply to RecordSet Filter

try using:
datCustomer.Recordset.Filter _ = "customerId Like 'B*'"

Collapse -

RecordSet Filter

by setivi In reply to RecordSet Filter

The question was auto-closed by TechRepublic

Collapse -

RecordSet Filter

by setivi In reply to RecordSet Filter

This question was auto closed due to inactivity

Back to Web Development Forum
7 total posts (Page 1 of 1)  

Related Discussions

Related Forums