bookmark - Help With Writing To Access Database With Vb.net

Help With Writing To Access Database With Vb.net

 
 Discussion by falcorassassin with 1 Replies.
 Last Update: April 8, 2009, 11:37 am
 
bookmark - Help With Writing To Access Database With Vb.net  
    
free web hosting
 
Hi guys,

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:

CODE

Public Class Form1


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

Mon Apr 6, 2009    Reply    New Discussion   


could not connect to a centralized DBHelp With Writing To Access Database With Vb.net

Please,

I am Francis Onodueze a student of IMSU

I have developed a Hotel Managment Software but for a considerable period of time, I have not been able to  access the DB from another computer; eventhough the software is runing perfectly as a standalone  software -  I need it  run on the network (centralized DB)

The platform: VB.Net

Connection String: DataSource=.SQLEXPRESS;AttachDbFilename=Infranet-e6ea07SharedDocsApp_DataDreamLandDB.Mdf;Integrated Security=True;User Insatnce=True

Error message: Infranet-e6ea07SharedDocsApp_DataDreamLandDB.Mdf failed. A database with the same name exist; or specified file cannot be opened, or it is located on UNC share

I cant forget this help if u rescue me from this trigger.

Your Programmer friend Francis

-question by Francis

 


Wed Apr 8, 2009    Reply    New Discussion   

Quickly Post to Help With Writing To Access Database With Vb.net  w/o signup Share Info about Help With Writing To Access Database With Vb.net  using Facebook, Twitter etc. email your friend about Help With Writing To Access Database With Vb.net Print
Reply / Comment Ask a Question? Share / Bookmark E-Mail a Friend Print

[.net]matchall Function   [.net]matchall Function (0) (3) Hlp In Docking Forms In Visual Studio 2008 I need popup docking forms help  Hlp In Docking Forms In Visual Studio 2008 I need popup docking forms help