473,800 Members | 2,640 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help With Search Function, I don't know where to start!!

markmcgookin
648 Recognized Expert Contributor
Hi Folks,

I have a VB app, and I have been working at it for a while, and I am now at the stage where I want to create a search function. Now don't be scared! It is in the .Net compact framework, and uses SQL Server CE as the database (This seems to scare off people trying to help! lol) but the connection and reading of data etc is all handled, and I think it is going to be a "relatively " simple function.

My database has a number of fields (Below is the code for creating the table I am referring to (edited for ease of reading)

Expand|Select|Wrap|Line Numbers
  1. tblDetails
  2. PRIMARY KEY, Flower_ID NTEXT, Name_Eng NTEXT, Name_Lat NTEXT, 
  3. Location_ID NTEXT, Habitat_ID NTEXT, Season_ID NTEXT, Family_ID NTEXT, 
  4. Height NTEXT, Flower_Shape NTEXT, Leaf_Shape NTEXT, Colour NTEXT, 
  5. Plant_Type NTEXT, Bloom_Size NTEXT, Cluster_Type NTEXT, Description 
  6. NTEXT
  7.  
So you can see my values

Flower_ID, Name_Eng, Name_Lat etc etc..

Now, I am going to create a form with a series of dropdown/combo boxes for the fields I want the user to be able to select from, these will be

cmbLocation, cmbHabitat, cmbSeason, cmbFamily, cmdHeight, cmbFlowerShape, cmbLeafShape, cmbColour, cmbPlantType, cmbBloomSize, cmbClusterType

Now, on a "Submit" esq Button I want the program to take in these values, and search through the records in (just) one table in the database and output the resulting rows Eng_Name to a listbox.

I already have an A-Z search function done, where the user selects a letter, and all the flowers starting with that letter are displayed.

It is this "composite" search key that I have NO IDEA where to start with, I have toyed with the idea of using a load of IF or CASE statements to form a concatenated SQL query, as one approach. But I thought that might bring me trouble when the user does not know a field because in this situation the search must search all values in that field.

e.g. - FlowerShape = 4petals, 5petals, 6petals, I Don't Know (Search all flower shapes)

Which will obviously return more results.

The idea of the search is to narrow the results with each piece of data the user reads in.

So really what I think some pseudocode would be is

Select * FROM tblDetails
Read in value1
IF value1 = "I Don't Know"
THEN
Move on...
ELSE
Remove all data from list where field1 != value1

Read in value2
IF value1 = "I Don't Know"
THEN
Move on...
ELSE
Remove all data from list where field2 != value2

However, this might be totally wrong.

I know this sounds like a scary request, but If you read the code you will see it is quite simple, the data reader reads in the whole line from the table and all the values are in order of position relative to their position in the statement above

e.g.
Temp = MyReader.GetStr ing(2) Is the flowers name
Temp = MyReader.GetStr ing(1) Is the primary key, Flower_ID

Ok, so I hope this hasn't bored you all, but I know it's better to be concise here than post too little.

I really need help with this folks, so please help me out!

Thanks very much for all your time and any responses!

Just a suggestion of a technique and some relevant classes/functions would be EXCELLENT, not looking for a code solution, just some help, or a similar exaple from somewhere!
Mar 9 '07 #1
3 2255
markmcgookin
648 Recognized Expert Contributor
Cheers for the Edit Killer42!

Mark
Mar 10 '07 #2
markmcgookin
648 Recognized Expert Contributor
Hey folks,

anyone got any help for me on this one? I really can't get my head around it.

I think what might suit me at this stage is simply a function that adds all the flowers to a list and simply eliminates the ones where

"valueX != InputX"

I know this method may be slow, and woefully poor for large amounts of data, but I can't seem to think of another way of acchieving what I want (NB: If someone has an idea that would achieve the same results but with a different method, I would REALLY appreciate some help!)

I think what I will do is put the search code in the loading of the results form, and on the submit of the search form, simply pass all the data rerieved to a module.vb file so all forms can see it.

Pleeeeeeeease help me out with some code here folks, I'm totally stuck.

Thanks!
Mar 15 '07 #3
markmcgookin
648 Recognized Expert Contributor
Possibly creating a recordset with all the data in it and then eliminating the ones that dont match?

Does anyone know if the compact framework supports recordsets?

lol help please <-- Doing some oliver twist style begging here
Mar 15 '07 #4

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

Similar topics

3
1764
by: Andy Jacobs | last post by:
Hi all I have a search function on a site of mine. At the moment, the content is delivered using this: <?php echo $row_Recordset1; ?> The search function goes through the table and displays the titles of the pages that contain the term.
7
2151
by: nortelsale | last post by:
I know nothing about programming but I am building a website (written with php) that allow people post some info. Is there a site I can get some templates or php scripts for an advanced search function? The Advanced Search function shall able to search any posted info by a postal code/zip code within certain kms and be able to search by map by clicking to US/Canada map to get to state, then to cities than to towns....
0
1683
by: Farooq Khan | last post by:
hi, my development team has been assigned a project that involves writing our own Web service. i happen to be a C++ programmer, new to C#/ASP.net. i dont know where to begin with......any article/book/link or anything that can help me start coding/getting those concepts, will be appreciated. Thanx, Farooq Khan
0
1385
by: Josh E | last post by:
Hi, There are two sections to the form that I am creating. In the top section, I have the fields that I want the users to be able to update. In the bottom section (subform), I have all the records listed in the datasheet view. These records are locked so that users can't manipulate them at all, only view them. 1.) Since the record source in both the main form and subform are the same, I know I can link them using any of the fields. ...
2
2499
by: Tiruak | last post by:
Hi there. Thanks in advance for the people reading and trying to help. I'm very begginer using flash and action script, and I tryed to do this one navigation menu. Since I dont have experience doing this, I did things in a way I thought it should work, to create the onmouseover animation of the buttons of my navigation menu. After a couple days working on it, I managed it to work almost the way I wanted it to, with 2 exceptions that I...
3
1444
by: alexmason86 | last post by:
getting a bit stuck here got some code that allows a user to input numbers to a 3x3 array. but next on the tutorial sheet i have to then ask the user for a number to search for and then search the array for that number and come back with its location in the array now i have the code that fils the array, but i dont know how to write the function, or what i should be passing to the function. i dont know how to get a location out of the other...
0
1427
by: kang jia | last post by:
hi currently i am doing this search function for car booking website. it can search through either car seats or CarModel. it seems it able to do search function, however i small problem occurs to me. As i would also like to show the customer whether the car is available or not available. Basically it is car status at the moment. However, i am not sure how to do this. my ideas is that if car_inventory>0, show available, otherwise show Not...
2
5597
by: Sreenivas | last post by:
I dont know how to compile cpp programs with gcc as i am new to gcc and cpp. could anybody help me out? Thanks&Regards, Srinivas Reddy Thatiparthy.
1
1630
by: nik707 | last post by:
Hello all, I would like to develop a date search from Form in Access. Here is the sample of previous search coding I have developed used the help of experts on this forum. 'Approach to CSR If Not IsNull(txtSearchField12) Then GCriteria4 = GetResults(Me.txtSearchField12, "", Me.optSearch) If GCriteria = "" Then GCriteria = GCriteria4
0
9690
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10504
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10274
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10251
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7576
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5469
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.