PDA

Click to See Complete Forum and Search --> : Help me out


isvijay
Feb 6th, 2004, 06:22 AM
Hi,

I have an activex exe and an client when called from the client the server should insert a record into oracle db, but it is not doing so and no error messages are given, the code is

can anybody let me know what is wrong with this code and why it is not working.


activex exe

class module
-----------------
Option Explicit

Public Property Set cnnCon1(cnnPassed As ADODB.Connection)
Set Form1.cnnCon = cnnPassed
End Property

Public Property Set rs1(rsPassed As ADODB.Recordset)
Set Form1.rs = rsPassed
End Property

Public Sub Display()
Form1.Show
End Sub


form module
-----------------
Option Explicit
Public cnnCon As ADODB.Connection
Public rs As ADODB.Recordset

Private Sub Command1_Click()
MsgBox "b4 add"
cnnCon.BeginTrans
rs.AddNew
rs("field1") = txtfield.Text
rs.Update
cnnCon.CommitTrans
MsgBox "after add"
End Sub




client
-------
Option Explicit
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim l As activex
Dim x As Object

Private Sub Command1_Click()
l.Display
End Sub

Private Sub Form_Load()
Set cnn = New ADODB.Connection
Set rs = New ADODB.Recordset
Set l = New activex

Set x = CreateObject("mj.activex")

With cnn
.CursorLocation = adUseClient
.CommandTimeout = 10
.Provider = "MSDAORA.1"
.ConnectionString = "Data Source = abc; User Id=abc; Password=abc"
.Open
End With

With rs
.ActiveConnection = cnn
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Open "Test", , , , adCmdTable
End With

Set l.cnnCon1 = cnn
Set l.rs1 = rs

End Sub

Private Sub Form_Unload(Cancel As Integer)
rs.Close
cnn.Close
Set rs = Nothing
Set cnn = Nothing
End Sub


thanks in advance

vijay