Hallo liebe User,

ich habe folgendes Problem:
und zwar will ich in eine Datei die auf einer AS400 liegt schreiben.

Zum Aufbau meines kleinen Programms:

Ich habe ein Flexgrid, mit einer CSV gefüllt (zb. Name, Vorname, Beruf, Telenr etc.)
Dann wähle ich per Combobox aus wo diese Felder in die Datei auf der AS400 hinsollen (zb. Name in AS400 Feld SYSNAME, Beruf in SYSBERUF)

Funktioniert auch wunderbar, nur wie bekomme ich es hin doppelte Einträge zu verhindern?Bzw. das wenn die Schlüsselfelder (Name & Vorname)
der Datensatz geupdatet wird ( zb. Name: Daniel , Nachname: Muster ; beim erste speichern nur die beiden Sachen angegeben, beim erneuten Speichern
soll noch Beruf und Telenr dann zu diesem ersten Satz hinzugespeichert werden)

Ist das möglich ? Wenn ja wie, komm einfach auf keine Lösung !

Hier mal ein Teil meines Programmcodes:
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Dim rowcount        As Integer
Dim listcount       As Integer
Dim listmax         As Integer
Dim ColMax          As Integer
Dim restCount       As Integer
Dim restMax         As Integer
Dim comboxCount     As Integer
Dim Output()        As String
Dim rest(0 To 2000) As String
 
 
 
AS400Connection
 
rs.Open "select * from " & Form1.txtBib.Text, cn, adOpenStatic, adLockOptimistic, adCmdText
 
listmax = combox(0).listcount
ColMax = MSFlexGrid1.Rows - 2
 
ff = FreeFile
 
Open CommonDialog1.FileName For Input As #ff
 
If Not EOF(ff) Then
    Line Input #ff, data
        Output = Split(data, ";")
        rowcount = UBound(Output) + 1
        MSFlexGrid1.Rows = rowcount + 1
    Seek 1, 1
End If
 
Do While Not EOF(ff)
    Line Input #ff, data
    Output = Split(data, ";")
 
    rs.Open "select * from " & Form1.txtBib.Text, cn, adOpenStatic, adLockOptimistic, adCmdText
    cn.BeginTrans
 
    rs.addnew
 
    Do
            Do Until comboxCount = ColMax + 1    
                If combox(comboxCount).Text = combox(comboxCount).List(listcount)  Then
                            rs.Fields(listcount).Value = Output(comboxCount)          
                    comboxCount = comboxCount + 1
            Loop
        comboxCount = 0
        listcount = listcount + 1
    Loop Until listcount = listmax
    rs.Update
    cn.CommitTrans
    rs.Close
Loop
Close #ff
End Sub
mir freundlichen grüßen

Naui