UniObjects for .NET - 读取和编写UniVerse文件

时间:2010-02-13 03:02:04

标签: vb.net u2 universe uniobjects

我们的组织正在使用UniObjects for .NET,但CD似乎已经丢失了。我需要弄清楚如何在Universe中读取和写入文件。请注意该程序是用VB.NET编写的

Dim uniSession As UniSession
Private DATABASE_IDENTIFIER As String = "uvcs"

uniSession = UniObjects.OpenSession(_hostname, _username, _password, _account, DATABASE_IDENTIFIER)

' Clear the already existing LICENCE_STATUS table
Dim nepiLicenceStatusFile As UniFile = uniSession.CreateUniFile("LICENCE_STATUS")
nepiLicenceStatusFile.Open()
nepiLicenceStatusFile.ClearFile()

' Insert new values in the LICENCE_STATUS table???
' Read values from the LICENCE_STATUS table???

我需要弄清楚如何插入新值,并从LICENCE_STATUS表中读取值。这里的任何人都可以帮助我吗?

1 个答案:

答案 0 :(得分:2)

首先,您可以在Rocket's website

上找到您的手册

以下是阅读/写作的一些例子

' read a record "2"
Dim ar_record As UniDynArray = nepiLicenceStatusFile.Read("2")

' write back as record "2new"
nepiLicenceStatusFile.Read("2new", ar_record)

' write a random string to a record
nepiLicenceStatusFile.write("2new", "My random string")

'read a field "7" from record "2"
Dim ar_record2 As UniDynArray = nepiLicenceStatusFile.ReadField("2", 7)

' write back to field "8"
nepiLicenceStatusFile.write("2", 8)

'read number of fields (4,5,6) from record "2"
Dim lFieldSet() As Integer = {4, 5, 6}
Dim ar_record3 As UniDynArray = nepiLicenceStatusFile.ReadFields("2", lFieldSet)

' read named field "LNAME" from record "2"
Dim ar_record4 As UniDynArray = nepiLicenceStatusFile.ReadNamedField("2", "LNAME")

' read records (2, 12, 3 and 4) as unidataset
Dim sArray As String() = {"2", "12", "3", "4"}

uSet = nepiLicenceStatusFile.ReadRecords(sArray)

我相信你现在明白了这个想法:)