Here is a quick bit of code I tried which successfully returns a list of open sales order numbers. The only other piece is to reference the Interop.Providex.dll
Also check out the Sage forums for lots of other code samples.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
Dim oScript As Object
Dim oSS As Object
oScript = New ProvideX.Script
oScript.Init("C:\Program Files\Sage Software\MAS 90\Version4\MAS90\Home")
oSS = oScript.NewObject("SY_SESSION")
Dim retVal As Object
retVal = oSS.nLogon()
If retVal = 0 Then
retVal = oSS.nSetUser("username", "password")
End If
retVal = Nothing
' Setup the Session object for the company and module
retVal = oSS.nsetcompany("ABC")
retVal = oSS.nSetDate("S/O", Now.ToString("yyyyMMdd"))
retVal = oSS.nSetModule("S/O")
Dim strResult As String = String.Empty
Dim strJunk As String = String.Empty
Dim strColumns As String = String.Empty
Dim strKeys As String = String.Empty
Dim strFilter As String = String.Empty
Dim strBeginKey As String = String.Empty
Dim strEndKey As String = String.Empty
' Instantiate a business object
Dim oData As ProvideX.PvxDispatch
retVal = oSS.nSetProgram(oSS.nLookupTask("SO_SalesOrder_UI"))
oData = oScript.NewObject("SO_SalesOrder_BUS", oSS)
' Add the columns to return
strColumns = "SalesOrderNo$"
' Key columns
strKeys = "SalesOrderNo$"
' Filter to only load open orders
strFilter += "OrderStatus$=" + Chr(34) + "O" + Chr(34) 'N=new, O=open, C=Closed, H=Hold
' Retrieve the results from MAS
oData.nGetResultSets(strColumns, strKeys, strResult, strJunk, strFilter, strBeginKey, strEndKey)
' Split the data into a string array
Dim strResults() As String = Split(Mid(strResult, 3, Len(strResult) - 3), Chr(138))
' If there are sales orders then do something.
If strResults.Length > 0 Then
' Show data on the web page or do something else here.
End If
' Cleanup
oData.DropObject()
oData = Nothing
If oSS IsNot Nothing Then
oSS.nCleanUp()
oSS.DropObject()
oSS = Nothing
End If
oScript = Nothing
Catch ex As Exception
End Try
End Sub