I'm not sure what you need but here is a sample of reading a MV and
writing either a new record or an additional MV.

This is a VB6 example for UniData

HTH

VERSION 5.00
Object = "{3ED50B81-0667-11D4-BE19-00104B2A91CE}#1.0#0";
"uniobjects.dll"
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   4245
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   4245
   ScaleWidth      =   4680
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   495
      Left            =   720
      TabIndex        =   5
      Top             =   3240
      Width           =   1575
   End
   Begin VB.TextBox Text4 
      Height          =   495
      Left            =   720
      TabIndex        =   4
      Text            =   "T0102513-1"
      Top             =   2400
      Width           =   3855
   End
   Begin VB.TextBox Text3 
      Height          =   495
      Left            =   720
      TabIndex        =   3
      Text            =   "Test Image"
      Top             =   1680
      Width           =   3855
   End
   Begin VB.TextBox Text2 
      Height          =   495
      Left            =   720
      TabIndex        =   2
      Text            =   "http://domain.com/your-image-location";
      Top             =   960
      Width           =   3855
   End
   Begin VB.TextBox Text1 
      Height          =   495
      Left            =   720
      TabIndex        =   0
      Text            =   "100!POD!0000033"
      Top             =   240
      Width           =   3855
   End
   Begin VB.Label Label4 
      Caption         =   "Ref. #"
      Height          =   255
      Left            =   120
      TabIndex        =   8
      Top             =   2520
      Width           =   495
   End
   Begin VB.Label Label3 
      Caption         =   "Desc."
      Height          =   255
      Left            =   120
      TabIndex        =   7
      Top             =   1800
      Width           =   495
   End
   Begin VB.Label Label2 
      Caption         =   "Link"
      Height          =   255
      Left            =   120
      TabIndex        =   6
      Top             =   1080
      Width           =   495
   End
   Begin UNIOBJECTSLibCtl.UnioaifCtrl Uni 
      Left            =   3960
      OleObjectBlob   =   "UniTest.frx":0000
      Top             =   3600
   End
   Begin VB.Label Label1 
      Caption         =   "Key"
      Height          =   255
      Left            =   120
      TabIndex        =   1
      Top             =   360
      Width           =   375
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim file As UniFile
Dim rec As UniDynArray
Dim MVIndex As Integer



Private Sub Command1_Click()
    If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or
Text4.Text = "" Then
        MsgBox "All fields required."
        Return
    End If
        
    myDate = Format(Now, "dd/mm/yy")
'    Uni.AccountPath = "/ud/TEST"               ' Testing account
    Uni.AccountPath = "/ud/IPS"                 ' Production account
    Uni.HostName = "prelude"
    Uni.UserName = "om"                         ' Ossie's ghost provides
good slave labor
    Uni.Password = "omm"                        ' We can easily identify
runaway processes by owner
    Uni.DataBaseType = 2
    Uni.Connect
    If Uni.IsActive Then
        Set file = Uni.OpenFile("OIS.IMAGE")
        If file Is Nothing Then
            Uni.Disconnect
            PukeAndDie "File Open Error"
        End If
        
        file.RecordId = Text1.Text
        file.Read
        
        If file.Record Is Nothing Or file.Error <> 0 Then
            ' New Record
            Set rec = Uni.DynamicArray
            rec.Value(1, 1).Ins Text2.Text
            rec.Value(2, 1).Ins Text3.Text
            rec.Value(3, 1).Ins DateNow
            rec.Value(4, 1).Ins DateNow
            rec.Value(5, 1).Ins "OM"
            rec.Value(6, 1).Ins Text4.Text
            rec.Value(7, 1).Ins "Y"
            file.Record = rec
        Else
            ' Record exists. Add new multivalue
            MVIndex = file.Record.Field(1).Count + 1
            file.Record.Value(1, MVIndex) = Text2.Text
            file.Record.Value(2, MVIndex) = Text3.Text
            file.Record.Value(3, MVIndex) = DateNow
            file.Record.Value(4, MVIndex) = DateNow
            file.Record.Value(5, MVIndex) = "OM"
            file.Record.Value(6, MVIndex) = Text4.Text
            file.Record.Value(7, MVIndex) = "Y"
        End If
        file.Write
        
        If file.Error <> 0 Then
            MsgBox "File Error "
        End If
        file.CloseFile
        Uni.Disconnect
    Else
        PukeAndDie "Connection Failed"
    End If
    
End Sub
Sub PukeAndDie(MsgText)
    MsgBox MsgText
    End
End Sub
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to