cancel
Showing results for 
Search instead for 
Did you mean: 

VB.Net - Query to get Sales Invoices

Former Member
0 Kudos

Hi,

I am programming an application that displays all information of "Sales Invoices" in a web page done in ASP.Net.

I can connect to SAP Business One 9.0 but I don't know how to send the request to it (the query).

This is the code I have.

        Dim oCompany As SAPbobsCOM.Company

        Dim lRetCode, lErrorCode As Long

        Dim sErrMsg As String

        'Instantiate a Company object

        oCompany = New SAPbobsCOM.Company

        'oCompany.Server = "(local)"

        oCompany.Server = "WINSERVER"

        oCompany.Server = "SAP"

        'oCompany.CompanyDB = "SBODemo_US"

        oCompany.CompanyDB = "SBODemoUS"

        oCompany.UserName = "manager"

        oCompany.Password = "manager"

        oCompany.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2008

        oCompany.DbUserName = "sa"

        oCompany.DbPassword = "Alfa321"

        oCompany.Connect()

        'Conecction result

        If lRetCode <> 0 Then

            oCompany.GetLastError(lErrorCode, sErrMsg)

        Else

            Label1.Text = "Connected!"

        End If

Accepted Solutions (0)

Answers (1)

Answers (1)

maik_delly
Active Contributor
0 Kudos

Hi José,

your code is connecting your program with SBO via DI API. This is not ideal for web programming.

Even though it kind of works there are other techniques to be prefered ( and it really doesn't work reliable for multiuser approaches ).

If you "just" want to show information I would recommend to to use pure .net SQL queries to retrieve information from SBO ( sales invoices : OINV, INV1 ... ) .

For adding / updating data in SBO from a web frontend have a look into DI Server or B1 integration framework ( B1iF). Both have quite a list of pros and cons ( plus license ).

As for your question:

Usually you would retrieve objects with a recordset object ( DB query ) or through a doument object.

If you don't know what I am talking about, have ( at least ) a look in the file "SDK_EN.chm" -> Developer's Guide.

Also there are several sample SDK projects available when SBO SDK is installed ( "C:\Program Files (x86)\SAP\SAP Business One SDK\Samples" )

regards,

Maik

Former Member
0 Kudos

Ok, if I consider I'm considering it) your suggestion on using pure SQL queries would this query be correct to get all Sales Invoices?

Select * from OINV;

Thanks.

maik_delly
Active Contributor
0 Kudos

Hi José,

this query would give you all header data for invoices ( also canceled and closed ones  ).

There are several child tables ( INV1- INV21 ) containing all kind of data for invoices ( lines, freight .... ). But in general the answer is yes.

regards,

Maik