473,746 Members | 2,710 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 2251
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
1763
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
2147
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
1678
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
1383
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
2497
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
1439
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
1424
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
5588
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
1625
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
8974
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
9508
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
9218
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8229
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4586
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
4836
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3292
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2765
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2199
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.