Nov 25, 2009

Help With Writing To Access Database With Vb.net

free web hosting
Open Discussion & Free Web Hosting > Computers & Tech > Programming > Programming General > BASIC / Visual Basic (.NET)

Help With Writing To Access Database With Vb.net

falcorassassin
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


 

 

 


Comment/Reply (w/o sign-up)

(G)Francis
could not connect to a centralized DB
Help 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-e6ea07\SharedDocs\App_Data\DreamLandDB.Mdf;Integrated Security=True;User Insatnce=True

Error message: \\Infranet-e6ea07\SharedDocs\App_Data\DreamLandDB.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

 


Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords :

  1. Auto-number Help In Access Db & Vb .net
    (6)
  2. How To Access Child Node / Collection Items In A Class
    Ways of accessing the child nodes of a Tree Node (6)
    CODE             Dim A As New TreeNode             MsgBox(A.Nodes(15).Text)
                MsgBox(A.Nodes("WTF").Text) Here are two ways of accessing the child nodes of a
    Tree Node, in this case, node A. In the first case, we have accessed the child node with Index = 15
    of node A. In the second case, we have accessed the child node "WTF" by its key. I want to be able
    to access the members of the Responses class in a similar fashion. Example:- CODE
            MsgBox(Responses("ASL").Text) Anybody knows how to go about creating the class? What
    the... I mi....
  3. VB.NET & MS Access Issue
    (7)
    Alright, I haven't had much experience with vb.net or ms access as it is, let alone using them
    together, so I need some advice on the best way to do this. I need to create a program that
    basically is a form to fill out with information, and upon filling it out it can be saved. Saving
    consists of making a row in a ms access database and placing each field as a column entry within
    this new row. Then I need to be able to retrieve this information from the DB and fill out the form
    as it was originally if the user chooses to load. This is all fine and wasn't hard to....
  4. VB.NET / MS Access Question
    (6)
    Jeez .. i can see people already starting to take up sticks and stones to beat me up .. well .. i
    know m annoying .. and this always happens when my questions are related to programming
    /biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> Newayz ..
    to the point .. I have an MS Access DB .. I need a VB Code to retrieve the value from a field in
    the table. Let me just put it in a better way. I have a table that has a column: Sno. .. under
    sno. i have numbers like 1,2,3,4,5,6,7,8 .... now i created a form where i could view the rec....
  5. VB6-MS Access Question
    help please (14)
    hi guys, I am developing an application in Visual Basic 6.0 and using MS Access as my backend. What
    i want is that my database should not open when someone doublec clicks on the .mdb file. But my
    application should be able to access it. What can be a possible solution to this problem? Please
    help. Thanx in advance.....

    1. Looking for Help, With, Writing, To, Access, Database, With, Vb.net

See Also,

*SIMILAR VIDEOS*
Searching Video's for Help, With, Writing, To, Access, Database, With, Vb.net
advertisement



Help With Writing To Access Database With Vb.net

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com