on 04-09-2008 1:26 PM
Good Day
Experts:
Earlier in the week, Leonardo helped me out with the line to set the dbType for SQL2005 in the code below. For the past couple of daya I have been testing with (local) for the Server. I then would get a list of db's on my local machine. However, this morning I am trying to get a list of db's from our Server but am receiving an error when executing line --> oRecordSet = oCompany.GetCompanyList.
The Server...does that just have to be the IP Address? What is the SAP code expecting here for the Server?
Thanks,
EJD
If e.KeyCode = Keys.Enter Or e.KeyCode = Keys.Tab Then
e.SuppressKeyPress = True
oCompany = New SAPbobsCOM.Company
'*****************************************
'Initialization Connection Properties
'Manadatory for SQL2005...other may differ
'*****************************************
oCompany.Server = txtServer.Text
oCompany.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2005
oCompany.language = SAPbobsCOM.BoSuppLangs.ln_English
oCompany.UseTrusted = True
oCompany.UserName = txtUser.Text
oCompany.Password = txtPassword.Text
'**************************
'Create a list of companies
'**************************
oRecordSet = oCompany.GetCompanyList
Hi,
It worked because you used (local) as server, but when you use another server UseTrusted must be false and you should also set BDUser and DBPassword to make it work.
Regards
Ad
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ad,
Thanks for replying. I have made sure my Trusted setting is equal to True and my User/Password is set.
Now, if I want to get a list of db's on a Server, do I just use the IP Address for oCompany.Server?
If that is correct, then I have some issue resulting. I get a messagebox --> Connection to SBO-Common had failed
Does this feel like my connection attempt is still not right? Or does that error message indicate I have troubles elsewhere?
Here is my code for the connection...it fails on --> oRecordSet = oCompany.GetCompanyList
The User and Password fields. How do I know what to use there? I use different UserNames/Passwords for each company when
logging in. Is this Username/Password going to be for some kind of SQL profile?
oCompany = New SAPbobsCOM.Company
'*****************************************
'Initialization Connection Properties
'Manadatory for SQL2005...other may differ
'*****************************************
oCompany.Server = txtServer.Text
oCompany.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2005
oCompany.language = SAPbobsCOM.BoSuppLangs.ln_English
oCompany.UseTrusted = True
oCompany.UserName = txtUser.Text
oCompany.Password = txtPassword.Text
'**************************
'Create a list of companies
'**************************
oRecordSet = oCompany.GetCompanyList
oCompany.GetLastError(lErrCode, sErrMsg)
If lErrCode <> 0 Then
MsgBox(sErrMsg)
Else
If cmbCompany.Items.Count > 0 Then
cmbCompany.Items.Clear()
End If
Do Until oRecordSet.EoF = True
cmbCompany.Items.Add(oRecordSet.Fields.Item(0).Value)
oRecordSet.MoveNext()
Loop
End If
Thanks,
Ed
User | Count |
---|---|
95 | |
11 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.