Hi Craig, thanks for your comments, but I can't seem to get that to work, it
says that add and count aren't part of the dictionaryBase or dictionaryEntry
(those being the only 2 dictionary things i could find in vb)

I think I'm nearly there with the array.

Thanks again for your help

John

On 13/07/06, Craig Morrison <[EMAIL PROTECTED]> wrote:

John Newby wrote:
> Hi Craig, I have looked into the dictionary that you suggested, but
> wouldn't
> this be the same as the array as I would still need to know how many
times
> to go through the while loop to add the names of the fields?  Also I
> need to
> get the names of the fields back out to populate a comboBox, which I
> already
> know how to do with an array.

item = myDict("hash")

Its pretty simple.

Use your favorite search engine to look for "scripting.dictionary" and
you will find a wealth of information on VBScript's dictionary object.

From an earlier message of yours:

>        ' select all field names from the selected table
>        sqlite_cmd.CommandText = (strSQL)
>        ' Now the SQLiteCommand object can give us a DataReader-Object:
>        sqlite_datareader = sqlite_cmd.ExecuteReader()
>        i = 0
>        While sqlite_datareader.Read()
>            'Try
>            fieldNames(i) = sqlite_datareader("name")
>            'atch es As Exception
>            '  MessageBox.Show(es.Message)
>            End Try
>            i += 1
>        End While
>
>        sqlite_datareader.Close()

You are already getting the field names on the fly, why do you insist on
  knowing how many fields there are?

After you populate the dictionary, you can get the count of items
(fields) by doing:

itemCount = myDict.Count

To attempt to stave off any more questions:

set fieldNames = CreateObject("Scripting.Dictionary")
sqlite_cmd.CommandText = (strSQL)
sqlite_datareader = sqlite_cmd.ExecuteReader()
i = 0
While sqlite_datareader.Read()
     fieldNames.Add i, sqlite_datareader("name")
     i += 1
End While
sqlite_datareader.Close()
fieldCount = fieldNames.Count

Your problem is *not* sqlite, but rather a command of VB itself. You
might want to spend some time getting up to speed on VB.

Or better yet, why don't you just pass a reference to the list box and
add them directly to it?

I'm not going to comment further on this topic as it is now QUITE far
off-topic.

--
Craig Morrison
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
http://pse.2cah.com
   Controlling pseudoephedrine purchases.

http://www.mtsprofessional.com/
   A Win32 email server that works for You.

Reply via email to