hi


i want to connect to oracle database but it give me error massege

"object required"

and itsn't insert data in to table

and whin i check by clecking on"F8" it will exexute with out insert

could you please check this code for me


Code:
 Private Sub ConnectToServer1(y As String)

procedure:
 
Dim StrSQL As String
On Error GoTo ErrMsg
Set rsMCare = New ADODB.Recordset
Set rsMCare.ActiveConnection = cnMCare

y = y & " , " & Format(Now, "HH:MM:SS")
 
   'y = y
   ' insert the value in the StuId table
                      
StrSQL = "insert into STUID VALUES("" & y & "");"
rsMCare.Source = StrSQL
rsMCare.Open

If rsMCare.State = 1 Then rsMCare.Close
Exit Sub
    
ErrMsg:
 MsgBox "Error: " & Err.Description
 
End Sub

Private Sub Form_Unload(Cancel As Integer)
    InRFIDCtrl1.Close
End Sub

 
Public Function ConnectToServer() As Boolean
'On Error Goto ErrMsg
  Set cnMCare = New ADODB.Connection
  
  ' here is the name,user and the password of the database
  cnMCare.Open "Provider=MSDAORA;DSN=coe485;uid=yosef;pwd=coe485"
  
  If cnMCare = adStateOpen Then
      MsgBox "Welcome to Pubs!"
   Else
      MsgBox "Sorry. No Pubs today."
   End If
  'cnMCare.Open "Provider=MSDASQL;DSN=;uid=user;pwd=password"
  Set rsMCare = New ADODB.Recordset
 
  cnMCare.CursorLocation = adUseClient
  rsMCare.CursorType = adOpenStatic          'use for reports only
  rsMCare.CursorLocation = adUseClient
  rsMCare.LockType = adLockPessimistic
  Set rsMCare.ActiveConnection = cnMCare
 
  ConnectToServer = True
  Exit Function
 
ErrMsg:
  MsgBox Err.Description
  ConnectToServer = False
  Exit Function
 
End Function
 
Public Status As Integer
Public cnMCare As ADODB.Connection
Public rsMCare As ADODB.Recordset
Public rsMCare1 As ADODB.Recordset
Public rsMCare2 As ADODB.Recordset