473,387 Members | 1,597 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Fast way of Searching & Dispalying thousands of Records

Hi, Im new to this Forum. Im facing a problem from long time.
I have a text box. If user types a character, I should display the itemname (records/data) into Flexgrid starting from those characters. Note that User only types the character and he doesn't press Enter key.

I ve return the code in Change event of the textox. But it is taking too much time. For every character I press, im calling search functioin where im searching and displaying the records starting from those characters....

Im Using VB6.0 and SQL Server 2000


Can anyone help me to get out from this problem....
Thanks in Advance....
Jul 10 '08 #1
5 3490
debasisdas
8,127 Expert 4TB
try to use LIKE search and use proper indexing on the database column.
Jul 10 '08 #2
Dököll
2,364 Expert 2GB
Greetings and salutations!

A simple way to start could be to set up an ODBC, DAO, or ADO connnection to your SQL Server database, assuming you already have a database built with fields needed, say the field to search is called ID, on your VB6 form, you would have a textbox searching just that field (ID), here's an example using DAO, you'll need to add Microsoft DAO 3.6 Library. It search:

Expand|Select|Wrap|Line Numbers
  1.  
  2. 'this is searching for existing data in your database
  3. Private Sub seek_Click()                      ' your search button
  4. Dim my_database As Database           'dimension database as database so program knows where to look for data
  5. Dim my_record As Recordset
  6. Dim test As String
  7. test = Text1(1).Text
  8. Set my_database = OpenDatabase("K:\Projects\DBMOVIE.mdf")   
  9. Set my_record = my_database.OpenRecordset("select * from Movie_Data_Table where movie_title like '" & Text1(1).Text & "'")    ' this is used to search by name, only if data already exists
  10.    Do While Not my_record.EOF  'this function will keep searching for fields matching each textbox
  11.         Text1(0).Text = my_record.Fields("UserID")
  12.         Text1(1).Text = my_record.Fields("movie_title")
  13.         Text1(2).Text = my_record.Fields("movie_type")
  14.         Text1(3).Text = my_record.Fields("rating_scale")
  15.         Text1(4).Text = my_record.Fields("movie_location")
  16.         Text1(5).Text = my_record.Fields("movie_format")
  17.    my_record.MoveNext
  18.    Loop
  19.    my_database.Close
  20. End Sub
  21.  
Hope this help steer it in the right direction for you...
Jul 10 '08 #3
try to use LIKE search and use proper indexing on the database column.

Thanks Debasisdas, for Ur reply...
Indexing means...? Im new to VB. Plz bare with me...
Jul 10 '08 #4
debasisdas
8,127 Expert 4TB
creating index is part of database not VB.

You need to create index on the fields which are frequently used in the where clause of the query in the tables.
Jul 10 '08 #5
creating index is part of database not VB.

You need to create index on the fields which are frequently used in the where clause of the query in the tables.

K...What is the purpose of View Tables (Views) in SQL SERVER? Can I use that.. Will it be helpful and become faster ?
Jul 18 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: aaj | last post by:
This is a simple question compared to some of the stuff that gets asked (and answered) here, but sometimes its easy to over look the simpler things. I've been working with databases for a few...
8
by: Neil | last post by:
I have a very puzzling situation with a database. It's an Access 2000 mdb with a SQL 7 back end, with forms bound using ODBC linked tables. At our remote location (accessed via a T1 line) the time...
33
by: Geoff Jones | last post by:
Hiya I have a DataTable containing thousands of records. Each record has a primary key field called "ID" and another field called "PRODUCT" I want to retrieve the rows that satisy the following...
2
by: Paul Bromley | last post by:
Can someone give me a pointer of the best way to show that an application is busy and has not locked up? I am writing a utility to search a network drive for a number of tiff files. I will...
13
by: comp.lang.php | last post by:
I have currently devised a way to display up to 3,000 records via PHP/HTML by using pagination techniques that stuff an entire DB query resultset into a $_SESSION object to use within pagination. ...
3
by: Ronald S. Cook | last post by:
I have a table of keywords (hundreds/thousands of records): KeywordID KeywordName --------- ----------- 1 Apple 2 Orange 3 Pear I then have a table of...
95
by: hstagni | last post by:
Where can I find a library to created text-based windows applications? Im looking for a library that can make windows and buttons inside console.. Many old apps were make like this, i guess ...
4
by: LetMeDoIt | last post by:
Greetings, I'm using ASP to retrieve from MSSQL and I then populate a table. After several months of successfull retrieves, this same code now bombs out. It turns out that if I clear out from...
4
by: Ty | last post by:
Hi all Short version of my problem: i have a Datagrid (Flexgrid from ComponentOne) with a Datatable as source. I need to search a row in the datatable, using a primary key column in the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.