//Put the contents of you file into a string object called 'data'
Dim In as TextInputStream = file.OpenAsTextFile
Dim data as String = In.Readall

//Loop through data and separate into networks
Dim n,entries as integer
Dim Networks() as string

for n = 0 to countfields(data,"NET:)
        Networks.append nthfield(data,"NET:",n)
next

//loop through each network, and insert all entries into the table
for n=0 to ubound(Networks)
for entries = 1 to countfields(Networks(n),EndOfLine) //skip the first line database.SQLexecute('INSERT INTO tablename SET Network = '"+Nthfield (Networks(n),EndOfLine,0)+"' Server = '"+n'"+Nthfield(Networks (n),EndOfLine,0)+ KEY_FIELD = '"'"+Nthfield(Networks(n),EndOfLine,0) +'"+Nthfield(Networks(n),EndOfLine,0)+"'")
        next
next

//commit the changes to the database
database.commit

The above assumes:
you already have a table set up with columns NETWORK, SERVER and KEY_FIELD, defined properly to accommodate these strings.
you have already connected to the database called 'database'

The may be quicker ways to do this, but this should work.

- Tom

NET: WINDOWS_OFFICE
SER: Win_Off_A
SER: Win_Off_B

NET: WINDOWS_Remote
SER: Win-Rem_A

NET: NY_Loc
SER: NY_A
SER: NY_B
SER: NY_C
SER: NY_D

I'd like to read this in line by line, and add each line to a database so:

NETWORK         SERVER          KEY_FIELD
WINDOWS_OFFICE  Win_Off_A       WINDOWS_OFFICEWin_Off_A
WINDOWS_OFFICE  Win_Off_B       WINDOWS_OFFICEWin_Off_B
WINDOWS_Remote  Win-Rem_A       WINDOWS_RemoteWin-Rem_A
NY_Loc          NY_A            NY_LocNY_A
NY_Loc          NY_B            NY_LocNY_B
NY_Loc          NY_C            NY_LocNY_C
NY_Loc          NY_D            NY_LocNY_D

Can someone walk me through the basic procedure to do this?

Thanks.

All My Best,
Jeffrey

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to