473,372 Members | 908 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,372 software developers and data experts.

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

648 Expert 512MB
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
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"
Move on...
Remove all data from list where field1 != value1

Read in value2
IF value1 = "I Don't Know"
Move on...
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

Temp = MyReader.GetString(2) Is the flowers name
Temp = MyReader.GetString(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 2220
648 Expert 512MB
Cheers for the Edit Killer42!

Mar 10 '07 #2
648 Expert 512MB
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.

Mar 15 '07 #3
648 Expert 512MB
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

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...
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...
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...
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...
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...
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...
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...
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.
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...
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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,...
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...
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.