...

View Full Version : Use Dictionary Object or Database?



hkucsis
12-13-2003, 04:28 AM
Hi,

I need to build a web-based application (ASP) that is similar to a dictionary. A user types in many words (range from 1 to serveral hundreds) and then I need to find out (one by one) whether these words exit in my database.

The words are already stored in SQL Server and my question is whether I should:

1. use a SQL statement to retrieve the words one by one (eg. a 300-word input means 300 querys)

2. use a dictionary object to first retrieve all the words from SQL server and then the user query the dictionary object

I have never used the dictionary object and hence don't know whether it is a good option in my case.

Thanks.
Michael

ez4me2c3d
12-13-2003, 08:57 AM
sorry i dont have the one stop answer fo ryou, but I would like to know why you are allowing the user to send a 300 word query to your site/db??

Is that necessary? I mean, wouldn't like 1 or 2 words be sufficient. and if they need more type those after they have received the results for the first search?

-------------

this is just theory, but let's say you have the user make their 300 word query.
you could split that into an array, then use a sub/function to build a query based on the ubound of the array and the values in it.

example...
For i = 0 to UBound(aList)
If i = UBound(aList) Then
qry = qry & "word=""" & aList(i) & """"
Else
qry = qry & "word=""" & aList(i) & """ OR "
End If
Next
qry = "SELECT * FROM table WHERE " & qryI dont even know if this would work. its not tested i just drafted it up at time of posting.

i don tknow. i was just throwing out an idea. could you tell more about this dictionary thing you're making. I dont quite get what its for. or doing.

M@rco
12-15-2003, 03:01 AM
StrInput = "words|separated|by|a|delimiter"
ArrInput = Split(StrInput, "|")
SQLString = "SELECT * FROM TableName WHERE Word IN ('" & Join(ArrInput, "' , '") & "')"(Note that there are single and double quotes in there, and that the delimiter could just as easily be a space)

I'm sure you can figure out how to use it! ;)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum