Hello Smart people!
I've done my research and self taught myself kinda how to use a database with VS2005 in VB. I've looked through the forums for an answer but cant find anything similar so sorry if this has been answered before. I'm using access (for ease of learning).
Here's my code to write back to my database:
I have some code to get from the database and save into an arraylist, the rest of the program is spent playing with the data and this section runs through the arraylist to save back to the database. The only thing is, it doesnt seem to do anything. The database doesnt seem to change atall after this procedure. I have no errors, and i'm sure its something simple that Ive just not got to full grips with yet.
Would really appreciate any help.
Thanks in advance.
I've done my research and self taught myself kinda how to use a database with VS2005 in VB. I've looked through the forums for an answer but cant find anything similar so sorry if this has been answered before. I'm using access (for ease of learning).
Here's my code to write back to my database:
Code:
Public Sub SetAccountsToDataBase()
Dim dsDataSet As New FPSdataDataSet.accountsDataTable
Dim dbaAdapter As New FPSdataDataSetTableAdapters.accountsTableAdapter
dsDataSet.Clear()
For Each AccountRow As AccountTypeStructure In colAccounts
Dim newAccountsRow As FPSdataDataSet.accountsRow = dsDataSet.NewaccountsRow
newAccountsRow.ID = AccountRow.intID
newAccountsRow.username = AccountRow.strUserName
newAccountsRow.password = AccountRow.strPassword
newAccountsRow.acctype = AccountRow.strType
dsDataSet.Rows.Add(newAccountsRow)
newAccountsRow = Nothing
Next
dbaAdapter.Update(dsDataSet)
dsDataSet.AcceptChanges()
dsDataSet = Nothing
dbaAdapter = Nothing
End Sub
I have some code to get from the database and save into an arraylist, the rest of the program is spent playing with the data and this section runs through the arraylist to save back to the database. The only thing is, it doesnt seem to do anything. The database doesnt seem to change atall after this procedure. I have no errors, and i'm sure its something simple that Ive just not got to full grips with yet.
Would really appreciate any help.
Thanks in advance.