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.AddNew()
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
rs.Update()
MsgBox("Saved")
rs.Close()
Call load_list()
clear()
End Sub