20.01.2015 Views

Teach Yourself e.net - Syspro

Teach Yourself e.net - Syspro

Teach Yourself e.net - Syspro

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Example 5.11. ASP.NET Visual Basic codebehind for Query.Browse<br />

' Logon and trap any exceptions<br />

Dim UserId As String<br />

Dim Obj As New Encore.Utilities()<br />

Try<br />

UserId = Obj.Logon("ADMIN", " ", "1", " ", 5, 0, 0, " ")<br />

Catch exc As Exception<br />

Response.Write("Exception - message:" & exc.Message)<br />

Exit Sub<br />

End Try<br />

' Run generic fetch returning a warehouse row<br />

Dim Qry As New Encore.Query()<br />

Dim XmlOut As String<br />

' Build an XML string to pass the table name and key<br />

Dim XmlIn As New System.Text.StringBuilder()<br />

XmlIn.Append("")<br />

XmlIn.Append("")<br />

XmlIn.Append("ArCustomer")<br />

XmlIn.Append("0000001")<br />

XmlIn.Append("GE")<br />

XmlIn.Append("browse.xsl")<br />

XmlIn.Append("")<br />

Try<br />

XmlOut = Qry.Browse(UserId, XmlIn.ToString())<br />

Catch exc As Exception<br />

Response.Write("Unable to run generic browse - \<br />

Exception:" & exc.Message)<br />

Exit Sub<br />

End Try<br />

Response.Write(XmlOut)<br />

Response.ContentType = "text/xml"<br />

' Logoff and Cancel your current Session<br />

Dim ReturnCode As Long<br />

ReturnCode = Obj.Logoff(UserId)<br />

Qry = Nothing<br />

Obj = Nothing<br />

5–16

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!