Created Table! How to add records?
Ok, I have used the following code to create a new table in my "kamo.mdb". Now that I have it set up, how can I add information to the columns? I read the info from the file and save the results as strings. I want to use these strings to create records in my table now. Say I have this:
strFilePath= "c:\my files"
strFileName= "Music.mp3"
etc.
I Want to add each string to it's corresponding column in the table. The code below should explain what I'm trying to do better. Any help is appreciated.
VB Code:
Dim cat As New ADOX.Catalog
Dim tbl As New ADOX.Table
' Open the catalog
cat.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=.\kamo.mdb;"
' Create a new Table object.
With tbl
.Name = categories.txtcategory.Text
' Create fields and append them to the new Table
' object. This must be done before appending the
' Table object to the Tables collection of the
' Catalog.
.Columns.Append "FilePath", adVarWChar
.Columns.Append "FileName", adVarWChar
.Columns.Append "Filesize", adVarWChar
.Columns.Append "Artist", adVarWChar
.Columns.Append "Title", adVarWChar
.Columns.Append "Album", adVarWChar
.Columns.Append "Frequency", adVarWChar
.Columns.Append "Bitrate", adVarWChar
.Columns.Append "Length", adVarWChar
.Columns.Append "Track#", adVarWChar
.Columns("Notes").Attributes = adColNullable
End With
' Add the new table to the database.
cat.Tables.Append tbl
Set cat = Nothing