这里以VB6.0代码为例。
一、先需要引用SDK.
二、声明一个Company对象。
1
Private
fCompany
As
SAPbobsCOM.Company
![](/Images/OutliningIndicators/None.gif)
三、创建一个方法。
1
Private
Sub
ConnectCompany()
2
Set
fCompany
=
New
SAPbobsCOM.Company
3![](/Images/OutliningIndicators/None.gif)
4
fCompany.CompanyDB
=
"
sbodemo_china
"
5
fCompany.Server
=
"
sapf
"
6
fCompany.UseTrusted
=
True
7
fCompany.UserName
=
"
manager
"
8
fCompany.Password
=
"
manager
"
9![](/Images/OutliningIndicators/None.gif)
10
iRetCode
=
fCompany.Connect
11
If
(iRetCode
<>
0
)
Then
12
MsgBox
"
Connect failed!
"
13
Else
14
MsgBox
"
Success to connect [
"
+
fCompany.CompanyName
+
"
]
"
15
End
If
16
End Sub
![](/Images/OutliningIndicators/None.gif)
2
![](/Images/OutliningIndicators/None.gif)
3
![](/Images/OutliningIndicators/None.gif)
4
![](/Images/OutliningIndicators/None.gif)
5
![](/Images/OutliningIndicators/None.gif)
6
![](/Images/OutliningIndicators/None.gif)
7
![](/Images/OutliningIndicators/None.gif)
8
![](/Images/OutliningIndicators/None.gif)
9
![](/Images/OutliningIndicators/None.gif)
10
![](/Images/OutliningIndicators/None.gif)
11
![](/Images/OutliningIndicators/None.gif)
12
![](/Images/OutliningIndicators/None.gif)
13
![](/Images/OutliningIndicators/None.gif)
14
![](/Images/OutliningIndicators/None.gif)
15
![](/Images/OutliningIndicators/None.gif)
16
![](/Images/OutliningIndicators/None.gif)
四、成功连接。
其实这个过程是很简单的。