| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Re: What`s wrong in this |
meusemailsporcarias{at}yahoo.com.br (VF)'s wild thoughts were
released on 8 Nov 2004 08:37:50 -0800 bearing the following
fruit:
>This search engine works very well with a 82kb database (MYDB001.mdb),
>but it freezes with another file with 1590kb (MYDB002.mdb). What's
>wrong? Is "mydb002" too large? Any tip to refine this code?
>--------------------------------------------------------------------------------
>Private Sub cmdSearch_Click()
> Dim db As Database
> Dim rs As Recordset
> Dim SearchString As String
> SearchString = txtSearch.Text
> Set db = OpenDatabase(App.Path & "\MYDB002.mdb")
> Set rs = db.OpenRecordset("Select AUTHOR From MYTABLE", , _
> dbForwardOnly)
> While Not rs.EOF
> If rs!AUTHOR = SearchString Then
> lstResults.AddItem rs!AUTHOR
> End If
> rs.MoveNext
> Wend
> rs.Close
> db.Close
>End Sub
That is probably the most inefficient way of doing that.
Private Sub cmdSearch_Click()
Dim db As Database
Dim rs As Recordset
Dim SearchString As String
Dim SQL as string
SearchString = txtSearch.Text
SQL = "SELECT AUTHOR FROM MYTABLE WHERE AUTHOR = '" &
searchstring & "'"
Set db = OpenDatabase(App.Path & "\MYDB002.mdb")
Set rs = db.OpenRecordset(SQL, dbForwardOnly)
While Not rs.EOF
lstResults.AddItem rs!AUTHOR
rs.MoveNext
Wend
rs.Close
db.Close
End Sub
HOWEVER, taking the code literally you might as well simply
do
lstResults.AddItem searchstring
Jan Hyde (VB MVP)
--
Once upon a time Old King Cole issued an order to his cooks. "From now
on," he decreed, "chopped cabbage must be mixed with mayonnaise." To
this day his decree is known as Cole's Law. (Gary Hallock)
[Abolish the TV License - http://www.tvlicensing.biz/]
---
þ RIMEGate(tm)/RGXPost V1.14 at BBSWORLD * Info{at}bbsworld.com
---
* RIMEGate(tm)V10.2áÿ* RelayNet(tm) NNTP Gateway * MoonDog BBS
* RgateImp.MoonDog.BBS at 11/8/04 4:44:30 PM
* Origin: MoonDog BBS, Brooklyn,NY, 718 692-2498, 1:278/230 (1:278/230)SEEN-BY: 633/267 270 5030/786 @PATH: 278/230 10/345 106/1 2000 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.