if (!sapConn.Logon(0, true))
{
Msg = "Cannot Log on to SAP"; //Issue message if cannot logon
return false;
}
登录进去了,但是不知如何调用(不用SAP.Connector 2.0),网上也找不到相关信息,只能到此为止。。。
C# 不行,那只能用VB.Net写类似Function了,打包成dll,在C#中调用。
以下是VB.Net调用C#例子:
Public Class QMSToSAP
Public strPostNO As String
Public strErrorMsg As String
Private strUser As String
Private strPassword As String
Private strClient As String
Private strApplicationServer As String
Private strLanguage As String
Private iSystemNumber As Integer
Public Sub New(ByVal user As String, ByVal password As String, ByVal client As String, _
ByVal applicationServer As String, ByVal language As String, ByVal systemNumber As Integer)
strUser = user
strPassword = password
strClient = client
strApplicationServer = applicationServer
strLanguage = language
iSystemNumber = systemNumber
End Sub
Public Function QMStoSAP(ByVal dt As DataTable) As Boolean
QMStoSAP = False
Dim sapConn As Object ''Declare variant
sapConn = CreateObject("SAP.Functions") ''Create ActiveX object