VB Script Example
Here is a sample of a simple VB script that selects records from NetSuite data. First, an instance of the RSSBus.ExcelAddIn.ExcelComModule class is initialized. Because the ExcelComModule class is compatible with all of the add-ins, calling the SetProviderName method is necessary to connect to the data source. The module object handles all interaction with the data source. It uses the defined connection string, executes a parameterized query, and iterates over the results of a query, which in this example is the result of a query for a specific Id.
Call DoSelect
Sub DoSelect()
pId = InputBox("Id:", "Get Id")
If pId = False Then
Exit Sub
End If
Set module = CreateObject("RSSBus.ExcelAddIn.ExcelComModule")
module.SetProviderName ("NetSuite")
Dim nameArray
nameArray = Array("Idparam")
Dim valueArray
valueArray = Array(pId)
module.SetConnectionString ("Account Id=XABC123456;Password=password;User=user;Role Id=3;Version=2013_1;Location=C:\\myfolder\\;")
If module.Select ("SELECT InternalId, AcctName FROM Account WHERE Id = @Idparam", nameArray, valueArray) Then
Dim count, InternalId
count = 0
InternalId = ""
While (Not module.EOF)
InternalId = module.GetValue(0)
module.MoveNext
count = count + 1
Wend
If count = 0 Then
MsgBox "The '" & pId &"' Id was not found."
Else
MsgBox "The '" & pId &"' Id was found."
End If
Else
MsgBox "The SELECT query failed."
End If
End Sub