Hi, I am trying to populate a ComboBox with the contents obtained within an ArrayList, but instead of putting the names held within the ArrayList, it writes "System.Collections.ArrayList" in the place of the desired names.
Could you take a look at my code and see where I am going wrong.
I am using vb.net 2002 version.
Any help is greatly appreciated.
Many thanks
John
This is the code for the function selectFieldNames :-
This is the code for populating the ComboBox :-
Could you take a look at my code and see where I am going wrong.
I am using vb.net 2002 version.
Any help is greatly appreciated.
Many thanks
John
This is the code for the function selectFieldNames :-
VB.NET:
Public fieldNames As New ArrayList()
Public Function selectFieldNames(ByVal strSQL As String) As ArrayList
' 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()
While sqlite_datareader.Read()
Try
fieldNames.Add(sqlite_datareader("name"))
MessageBox.Show(sqlite_datareader("name"))
Catch es As Exception
MessageBox.Show(es.Message)
End Try
End While
Return fieldNames
End Function
VB.NET:
Private Sub frmCreateIndex_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
dbConn.openExistingDatabse("Data Source=" & getDBName() & ";Version=3;New=False;Compress=True;")
dbConn.createSQLCommand()
Dim a As Integer
Try
dbConn.selectFieldNames("pragma table_info(test)")
For a = 0 To (dbConn.fieldNames.Count) - 1
cmbFieldIndex.Items.Add(dbConn.fieldNames)
Next a
Catch es As Exception
MessageBox.Show(es.Message)
End Try
End Sub