Hi guys i am trying to save information in to my access database , i created new instance of an ADODB.Connection object and ADODB.Recordset object but visual studio 2005 is given me an error message that ADODB.connection and ADODB.Recordset are defined, please can any one help
this is my code

Public Class Form1
    Dim con As New ADODB.Connection
    Dim rs As New ADODB.Recordset
    Dim str As String

    Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
        If txtPatientID.Text = "" Then
            MsgBox("Patient ID should never be empty")
            Exit Sub
        End If

        rs = New ADODB.Recordset
        rs.Open("Select  *  from  Inpatientregisteration", con, 1, 2)
        rs.Fields(0).Value = txtPatientID.Text
        rs.Fields(1).Value = txtFname.Text
        rs.Fields(2).Value = txtLName.Text
        rs.Fields(3).Value = txtGender.Text
        rs.Fields(4).Value = txtDOB.Text
        rs.Fields(5).Value = txtCard.Text
        rs.Fields(6).Value = txtAddress.Text
        rs.Fields(7).value = txtPhoneHome.Text
        rs.Fields(8).value = txtMobile.Text
        rs.Fields(9).value = txtOccupation.Text
        rs.Fields(10).value = txtStatus.Text
        rs.Fields(11).value = txtNationality.Text

        Call load_list()
    End Sub

Recommended Answers

All 5 Replies


Dim con As New ADODB.Connection

Where do you add the connection string and issue the open method?

Hi clocker, think you may not have added a reference to adodb
Click on Project, Add Reference, click on the COM tab, scroll down the list and select Microsoft ActiveX Data Objects 2.8 Object Library (or whichever version you wish) and click ok

thanks man, i added the reference to adodb now it is working

please who can help me ? i would be very grateful.
i would love to convert contents on one column to headers

like making the contents to be headers that accepts data from another column

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.