.NET Code Example: HelloWorld application

The following code example shows how simple it is to create your first straitPortal app. It shows howto get a list of users from the PLM system.

HelloWorld.vb

Imports Infostrait.Generic.StraitWeb.Shared

Module [Module]
Sub Main()
Console.WriteLine("My first straitPortal Application.")
Console.WriteLine("Connecting...")

Dim query As SimpleDataRetrieveDefinition
query = New SimpleDataRetrieveDefinition()
query.Class.ClassName = "Users"
query.Attributes.Add(New Attribute("LOGIN"))

Try
Dim result As DataSet
result = LibraryFactory.GetLibrary(My.Settings.DefaultServiceUrl).Query(query).ConvertToDataSet()
Console.WriteLine("Listing PLM users: ")

If result.Tables.Count > 0 Then
For Each row As DataRow In result.Tables(0).Rows
Console.WriteLine("> " & row("LOGIN").ToString)
Next
Else
Console.WriteLine("No result.")
End If
Catch ex As Exception
Console.WriteLine("Error retrieving users: " & ex.Message)
End Try

Console.WriteLine("Press [ENTER] to exit the application.")
Console.ReadLine()
End Sub
End Module

  • Comment @ .NET Code Example: HelloWorld application
  • RSS