Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently November 5th, 2024, 6:37 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Listbox and Database!
PostPosted: July 11th, 2007, 12:14 pm 
Offline

Joined: July 26th, 2005, 6:02 pm
Posts: 14
Hi all,

I'm working on a dictionary project with a MS Access database.
I need advises about two important problems I've experienced.

1. I've created a listbox and a script (for populating the listbox). when I searched a phrase the required results appears in the listbox, but when I repeat the searching process with a different phrase, the results appear under the old results. What is the way of clearing the content of listbox before the search process?

2. My database has nearly 70000 word entries and when I search for words including a phrase it takes 30 secs for system to turn out the results. This problem occurs due to listbox populating process. Is there any alternative way for handling this process.

Thanks for your assistance....

Doruk AR
Media Team


Top
 Profile  
 
 Post subject: Re;
PostPosted: July 12th, 2007, 11:41 am 
Offline

Joined: December 14th, 2004, 5:08 pm
Posts: 55
Location: Holland
Opus: version 8.0
OS: XP, Vista, Windows7, Windows8
System: Intel Corei7-2600 CPU 3.400GHz
Maybe you can show a sample or part of the pub so we can check it out..
Cheers

Jim


Top
 Profile  
 
 Post subject:
PostPosted: July 12th, 2007, 12:06 pm 
Offline

Joined: July 26th, 2005, 6:02 pm
Posts: 14
Thanks for your reply Jim.

Here is the script for populating the listbox. The database is about 70MB so that I am not able to send the whole publication. However, I think the problem occurs because of the "for" loop for the values of "count" variable greater than 1000.

Thanks again for your time..

Doruk

Code:
var mydb = new Database("FILEDSN=C:\\Documents and Settings\\Kurgu02\\Desktop\\ara\\guitdk\\sozluk01.dsn;")
function SearchDB()
{
records = mydb.ExecuteSQL("SELECT HEAD_MULT FROM Maddeler Where HEAD_MULT LIKE '"+aranankelime+"%';")
count = records.GetNumberOfRecords()
for (n=0;n<count ;n++) { // When I limit the "count" variable to 100 the performance problem ends.
Listbox.ReplaceSelection(records.HEAD_MULT + "\n")
records.NextRecord()
}//for
}


Top
 Profile  
 
 Post subject:
PostPosted: July 12th, 2007, 12:56 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Use Listbox.SetSelection(0,-1) before you populate the listbox to stop the duplication.

As for the speed, you could try reading the DB values to a variable first

i=i+DB_Value+'\n'

and then replacing the the listbox with the variable.

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject:
PostPosted: July 12th, 2007, 4:50 pm 
Offline

Joined: July 26th, 2005, 6:02 pm
Posts: 14
Mack,

Both of your solutions worked and solved my problems. Thank you very much for it.

I need one more solution about listboxes. Is there any way to fetch the line number (listbox index) of the selected lines.


Thanks again.

Doruk


Top
 Profile  
 
 Post subject:
PostPosted: July 12th, 2007, 5:15 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
If my memory is correct, you can make Opus store this value in a variable. Its on the Listbox tab under properties for the listbox.

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group