I'm trying to write data from an excel spreadsheet to an Access database. When i run my program a message appears saying that the correct number of records have been saved, however when i check my access database no records have been written to the database table. Any help or advice would be greatly appreicated. Thanks in advance.
The code for writing to database:
Dim connection As OleDbConnection
Dim Command As OleDbCommand
Private Sub btnTestRecords_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTestRecords.Click
[tab][/tab] 'database code
[tab][/tab] Dim strCommand As String
[tab][/tab] Dim intRows As Integer
[tab][/tab] Dim TCaseID As ArrayList = comp.GetTestCaseID()
[tab][/tab] Dim TIteration As ArrayList = comp.GetTestIteration()
[tab][/tab] Dim TstID As ArrayList = comp.GetTestID()
[tab][/tab] Dim TRelease As ArrayList = comp.GetRelease()
[tab][/tab] Dim TStatus As ArrayList = comp.GetTestStatus()
[tab][/tab] Dim TDate As ArrayList = comp.GetTestDate()
[tab][/tab] Dim TTester As ArrayList = comp.GetTester()
[tab][/tab] Dim TComments As ArrayList = comp.GetComments()
[tab][/tab] Dim TIssue As ArrayList = comp.GetIssueID()
[tab][/tab] connection.Open()
[tab][/tab] For i As Integer = 0 To TCaseID.Count - 1
[tab][/tab][tab][/tab] Dim tmp As String = TCaseID(i)
[tab][/tab][tab][/tab] Dim length As Integer = TComments(i).ToString().Length
[tab][/tab][tab][/tab] strCommand = "INSERT INTO Test_Result (TestCaseID, TestIteration, TestID, Release, Status, TestDate, Tester, Comments, Issue) VALUES ("
[tab][/tab][tab][/tab] strCommand &= "'" & TCaseID(i) & "', '" & TIteration(i) & "', '" & TstID(i) & "', '" & TRelease(i)
[tab][/tab][tab][/tab] strCommand &= "', '" & TStatus(i) & "', '" & TDate(i) & "', '" & TTester(i) & "', '" & TComments(i) & "', '" & TIssue(i) & "')"
[tab][/tab][tab][/tab] Command = New OleDbCommand(strCommand, connection)
[tab][/tab][tab][/tab] intRows += Command.ExecuteNonQuery
[tab][/tab] Next
[tab][/tab] MsgBox(intRows & " Test Data Successfully Updated!")
[tab][/tab] Me.Validate()
[tab][/tab] Me.Test_ResultBindingSource.EndEdit()
[tab][/tab] Me.Test_ResultTableAdapter.Update(Me.TestManagementProjectDataSet.Test_Result)
[tab][/tab] connection.Close()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
[tab][/tab] 'This line of code loads data into the 'TestManagementProjectDataSet.Test_Result' table.
[tab][/tab] Me.Test_ResultTableAdapter.Fill(Me.TestManagementProjectDataSet.Test_Result)
[tab][/tab] connection = New OleDbConnection(Test_ResultTableAdapter.Connection.ConnectionString)
End Sub
End Class

