cancel
Showing results for 
Search instead for 
Did you mean: 

Help~~~~, About SBO DI API 6.7 Connect Exception

Former Member
0 Kudos

Hello

My SBO DI API application(VB.NET 2005 BETA2) can't connect to the server,when run objCom.Connect()(SAPbobsCOM.Company),the system cathch a AccessViolationException!!

My DI API Version:6.7

My SBO Version:2004B

My System:WinXP with SP2

But when I Use other DI API(Version:6.5),it can connect to the server without error or exception.

Thanks

Cloud

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi hch Yang,

Please post the code you are using so we can see if we can find a problem.

Thanks,

Adele

Former Member
0 Kudos

Ok

This is my code:

Public Class loginFrm

Private oCom as SAPbobsCOM.Company

Private Sub btConnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btConnect.Click

oCom = New SAPbobsCOM.Company

With oCom

.Server = "MyServer"

.CompanyDB = "JNTest"

.DbUserName = "manager"

.DbPassword = "manager"

.DbUserName = "sa"

.DbPassword = "sa"

.language = SAPbobsCOM.BoSuppLangs.ln_ln_English

.UseTrusted = False

End With

Dim iRet, iErr As Integer

Dim sErrMsg As String = vbNullString

Try

iRet = oCom.Connect()

If iRet <> 0 Then

oCom.GetLastError(iErr, sErrMsg)

MsgBox(sErrMsg)

Return

End If

MsgBox ("Connect Success")

Catch ex As Exception

MsgBox(ex.ToString)

End Try

End Sub

End Class

Former Member
0 Kudos

Hi,

I see that you have used the DbUserName and DbPassword properties twice:

.DbUserName = "manager" 
.DbPassword = "manager"
.DbUserName = "sa"
.DbPassword = "sa"

You should use:

.<b>UserName</b> = "manager" 
.<b>Password</b> = "manager"
.DbUserName = "sa"
.DbPassword = "sa"

Ensure that all the settings you are using are right, including all user names, passwords, computer names, etc.

Hope it helps,

Adele

barend_morkel2
Active Contributor
0 Kudos

Mr Yang,

Is the machine name you are trying to connect to "MyServer"? It needs to be the machine name on the domain that is hosting the company DB.