Click here to Skip to main content
13,252,933 members (50,671 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
Hi guys,
I am trying to store siftsize data which is integer from SQL database 2008 to a list, then compare between them like list [i] and list[i+1] then chose the correspondant images to the siftsize and display it in a listview.
First, I used a dictionary but it dodn't work.
I tried lists, same result, i mean no result !!
Please help ..

What I have tried:

<pre>Query = "select siftSize from framesDef"
cmd.CommandText = Query
Dim res = cmd.ExecuteReader()
While res.Read()
    'sic.Add(res("frameID"), res("siftSize"))
    ar.Add(res("siftSize"))
    'res_lab.Text = ar(indx)
    'Just to test the dictionary
    indx += 1
End While
For j As Integer = 0 To indx
    If ar.ElementAtOrDefault(indx) And >= 463 Then
        Query = "select frameName from framesDef where siftSize  between 510 and 1000"
        cmd.CommandText = Query
        Dim res2 = cmd.ExecuteReader()
        While res2.Read()
            'trying to put the result of the query in a list named: fid
            fid.Add(res("frameName"))
        End While
    End If
    For Each i As String In Directory.GetFiles("C:\Users\DELL\Documents\Visual Studio 2010\Projects\4\testFolder4")
        If fid.ElementAtOrDefault(indx) = i Then
            'resulted images in the listview: lv_res
            lv_res.Items.Add(i)
        End If
    Next
Next
Posted 20-Mar-17 13:11pm
Updated 20-Mar-17 15:26pm
v3
Comments
NotPolitcallyCorrect 20-Mar-17 19:46pm
   
Learn how to use the debugger to debug your code, then you could give people helpful information instead of "no result".

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Quote:
First, I used a dictionary but it dodn't work.
I tried lists, same result, i mean no result !!

This is not helpful.

When you don't understand what your code is doing or why it does what it does, the answer is debugger.
Use the debugger to see what your code is doing. Just set a breakpoint and see your code performing, the debugger allow you to execute lines 1 by 1 and to inspect variables as it execute, it is an incredible learning tool.

Debugger - Wikipedia, the free encyclopedia[^]
Mastering Debugging in Visual Studio 2010 - A Beginner's Guide[^]
Basic Debugging with Visual Studio 2010 - YouTube[^]

The debugger is here to show you what your code is doing and your task is to compare with what it should do.
There is no magic in the debugger, it don't find bugs, it just help you to. When the code don't do what is expected, you are close to a bug.
  Permalink  
Comments
Ralf Meier 21-Mar-17 4:25am
   
Hi Patrice,
it's unbelievable how often you (or someone else) could give this as answer especially during the last weeks ...
It seems to me that the use of the Debugger is no longer a part of the education ...
But ... never the less ... it is the Solution to the question ...
+5
ppolymorphe 21-Mar-17 4:45am
   
Thank you.
Me an other are giving this advice too often, I agree, it is unbelievable that one can learn coding without knowing the debugger.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web02 | 2.8.171114.1 | Last Updated 20 Mar 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100