|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Whats wrong with this!!!!
if request.querystring("lookup") = "True" then
skus = Trim(replace(request.form("skus")," ","")) skus = replace(skus,Chr(10),",") skus = replace(skus,Chr(11),",") skus = replace(skus,Chr(12),",") skus = replace(skus,Chr(13),",") vSkus = split(skus, ",") Set dict1=Server.CreateObject("Scripting.Dictionary") Set dict2=Server.CreateObject("Scripting.Dictionary") Set rs = Server.CreateObject("ADODB.Recordset") for i = 0 to ubound(vSkus) dict1.Add trim(vSkus(i)), i next sSQL = "SELECT [Product Name], [Standard Code] FROM PC_Query;" rs.Open sSQL, sConnAnket rs.movefirst for each objItem in rs.fields do while not rs.eof dict2.add rs("Product Name"),rs("Standard Code") cnt = cnt + 1 rs.movenext loop next Set rs = Nothing rs.close ver_sku=dict1.keys ver_count=dict1.items vl_sku = dict2.keys vl_unspsc = dict2.items for i = 0 to dict2.count-1 if dict1.Exists(v1_sku)= true then Response.Write ("Found Matching SKU") else Response.Write("SKU Does not have a UNSPSC") end if next response.write "<br>Searched " & cnt & " records." I cannot get the damned thing to compare Dict1.key to Dict2.Key then post the results if same of dict2.key & dict2.item Help me....help me...I'm lost in a see of cumbersome dictionary objects. |
|
#2
|
|||
|
|||
|
Your example is a little too busy for anybody to answer your question at a glance. You would be better to trim it down to the bare minimum and also give an examplae html form that post the data as well.
All this said and having not tried to run any of your code, you would be well advised to print out the typename of all things that you place into and get out of the dictionaries. Dictionaries have a habit of putting things in under odd types. ie. if an integer comes out of a database recordset and is added to a dictionary it is sometimes saved in the dictionary with a typename of "field" or possibly "variant" or even "integer". You should explicitly cast variables to a known types before adding to a dictionary using CInt, CFloat, CSting etc. You should probably convert the variable to the same typename before you compare them also. If this is not what the problem is, I'm sure a more simplified example will clearly show what the problem is.
__________________
-- ngibsonau |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Whats wrong with this!!!! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|