pedromrs
24th October 2002, 14:35
Hi,
I'm working on the tccom0101m000 session using OLE automation.
I was expecting when entering a new employee with an existing ID to get an error message of some kind from Baan.
Also I'm wondering if running all the code in a Baan DLL would be faster. Executing this piece of code is turning out to be slow.
If I want to run a DLL do I need the source code? (I don't have it). If not, how do I compile the dll assuming a Windows NT installation of Baan?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim BaanObj As Baan4.Baan4
Dim FunctionDLL As String
Dim SessaoEmpg As String
Dim Cmp_emp, Cmp_lg, Cmp_nome, Cmp_dt_ini_cont, Cmp_pais As String
Dim ErrMessage1 As String
'My connection was Automatic since I changed a registry entry to
'run a different .bwc file.
'run Baan Application
BaanObj = CreateObject("Baan4.Application")
BaanObj.Timeout = 60
On Error GoTo BaanAutomationError
FunctionDLL = "ottstpapihand"
SessaoEmpg = "tccom0101m000"
'Campos
Cmp_emp = "tccom001.emno"
Cmp_lg = "tccom001.clan"
Cmp_nome = "tccom001.nama"
Cmp_dt_ini_cont = "tccom001.sdte"
Cmp_pais = "tccom001.ccty"
'Abrir a sessao de empregados tccom0101m000
BaanObj.ParseExecFunction(FunctionDLL, "stpapi.put.field(" & Chr(34) & SessaoEmpg & Chr(34) & "," & Chr(34) & Cmp_emp & Chr(34) & "," & Chr(34) & "4904" & Chr(34) & ")")
BaanObj.ParseExecFunction(FunctionDLL, "stpapi.put.field(" & Chr(34) & SessaoEmpg & Chr(34) & "," & Chr(34) & Cmp_lg & Chr(34) & "," & Chr(34) & "P" & Chr(34) & ")")
BaanObj.ParseExecFunction(FunctionDLL, "stpapi.put.field(" & Chr(34) & SessaoEmpg & Chr(34) & "," & Chr(34) & Cmp_nome & Chr(34) & "," & Chr(34) & "Paulo Capelo" & Chr(34) & ")")
BaanObj.ParseExecFunction(FunctionDLL, "stpapi.put.field(" & Chr(34) & SessaoEmpg & Chr(34) & "," & Chr(34) & Cmp_dt_ini_cont & Chr(34) & "," & Chr(34) & "12102002" & Chr(34) & ")")
BaanObj.ParseExecFunction(FunctionDLL, "stpapi.put.field(" & Chr(34) & SessaoEmpg & Chr(34) & "," & Chr(34) & Cmp_pais & Chr(34) & "," & Chr(34) & "XRT" & Chr(34) & ")")
BaanObj.ParseExecFunction(FunctionDLL, "stpapi.insert(" & Chr(34) & SessaoEmpg & Chr(34) & "," & "1" & "," & Chr(34) & ErrMessage1 & Chr(34) & ")")
If BaanObj.Error <> 0 Then
MsgBox(ErrMessage1)
End If
'BaanObj.ParseExecFunction(FunctionDLL, "stpapi.set.report(" & Chr(34) & SessaoEmpg & Chr(34) & "," & Chr(34) & RapportImpression & Chr(34) & "," & Chr(34) & CodeImprimante & Chr(34) & "," & Chr(34) & ErrMessage1 & Chr(34) & ")")
'Fechar o Baan
If Not BaanObj Is Nothing Then
BaanObj.Quit()
BaanObj = Nothing
End If
Exit Sub
'Não conseguiu criar o objecto Baan
CannotCreateBaan:
MsgBox("Unable to start Baan")
Exit Sub
'Não conseguiu iniciar o Baan
BaanAutomationError:
MsgBox("Baan IV automation error: " & BaanObj.Error)
BaanObj.Quit()
BaanObj = Nothing
Exit Sub
End Sub
Thanks in advance,
I'm working on the tccom0101m000 session using OLE automation.
I was expecting when entering a new employee with an existing ID to get an error message of some kind from Baan.
Also I'm wondering if running all the code in a Baan DLL would be faster. Executing this piece of code is turning out to be slow.
If I want to run a DLL do I need the source code? (I don't have it). If not, how do I compile the dll assuming a Windows NT installation of Baan?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim BaanObj As Baan4.Baan4
Dim FunctionDLL As String
Dim SessaoEmpg As String
Dim Cmp_emp, Cmp_lg, Cmp_nome, Cmp_dt_ini_cont, Cmp_pais As String
Dim ErrMessage1 As String
'My connection was Automatic since I changed a registry entry to
'run a different .bwc file.
'run Baan Application
BaanObj = CreateObject("Baan4.Application")
BaanObj.Timeout = 60
On Error GoTo BaanAutomationError
FunctionDLL = "ottstpapihand"
SessaoEmpg = "tccom0101m000"
'Campos
Cmp_emp = "tccom001.emno"
Cmp_lg = "tccom001.clan"
Cmp_nome = "tccom001.nama"
Cmp_dt_ini_cont = "tccom001.sdte"
Cmp_pais = "tccom001.ccty"
'Abrir a sessao de empregados tccom0101m000
BaanObj.ParseExecFunction(FunctionDLL, "stpapi.put.field(" & Chr(34) & SessaoEmpg & Chr(34) & "," & Chr(34) & Cmp_emp & Chr(34) & "," & Chr(34) & "4904" & Chr(34) & ")")
BaanObj.ParseExecFunction(FunctionDLL, "stpapi.put.field(" & Chr(34) & SessaoEmpg & Chr(34) & "," & Chr(34) & Cmp_lg & Chr(34) & "," & Chr(34) & "P" & Chr(34) & ")")
BaanObj.ParseExecFunction(FunctionDLL, "stpapi.put.field(" & Chr(34) & SessaoEmpg & Chr(34) & "," & Chr(34) & Cmp_nome & Chr(34) & "," & Chr(34) & "Paulo Capelo" & Chr(34) & ")")
BaanObj.ParseExecFunction(FunctionDLL, "stpapi.put.field(" & Chr(34) & SessaoEmpg & Chr(34) & "," & Chr(34) & Cmp_dt_ini_cont & Chr(34) & "," & Chr(34) & "12102002" & Chr(34) & ")")
BaanObj.ParseExecFunction(FunctionDLL, "stpapi.put.field(" & Chr(34) & SessaoEmpg & Chr(34) & "," & Chr(34) & Cmp_pais & Chr(34) & "," & Chr(34) & "XRT" & Chr(34) & ")")
BaanObj.ParseExecFunction(FunctionDLL, "stpapi.insert(" & Chr(34) & SessaoEmpg & Chr(34) & "," & "1" & "," & Chr(34) & ErrMessage1 & Chr(34) & ")")
If BaanObj.Error <> 0 Then
MsgBox(ErrMessage1)
End If
'BaanObj.ParseExecFunction(FunctionDLL, "stpapi.set.report(" & Chr(34) & SessaoEmpg & Chr(34) & "," & Chr(34) & RapportImpression & Chr(34) & "," & Chr(34) & CodeImprimante & Chr(34) & "," & Chr(34) & ErrMessage1 & Chr(34) & ")")
'Fechar o Baan
If Not BaanObj Is Nothing Then
BaanObj.Quit()
BaanObj = Nothing
End If
Exit Sub
'Não conseguiu criar o objecto Baan
CannotCreateBaan:
MsgBox("Unable to start Baan")
Exit Sub
'Não conseguiu iniciar o Baan
BaanAutomationError:
MsgBox("Baan IV automation error: " & BaanObj.Error)
BaanObj.Quit()
BaanObj = Nothing
Exit Sub
End Sub
Thanks in advance,