You can also create a snapshot from static data, without having a connection to a DSN. To do so, use any of the following techniques:
The following list provides the details for these methods, all of which are in the EnsLib.SQL.Shapshot class:
Consider a file that has the following contents:
value A1,value A2,value A3
value B1, value B2 ,value B3
The following code reads this file, uses it to create a snapshot, and writes simple comments to the Terminal. Notice that the only arguments used are the filename and the column separator:
w "number of rows in snapshot=",snap.RowCount,!
w "current row=",snap.%CurrentRow,!
w "data in first column=",snap.GetData(1),!
w "data in second column=",snap.GetData(2),!
w "data in third column=",snap.GetData(3),!
The output from this routine is as follows:
number of rows in snapshot=3
data in first column=col1
data in second column=col2
data in third column=col3
data in first column=value A1
data in second column=value A2
data in third column=value A3
data in first column=value B1
data in second column=value B2
data in third column=value B3
Notice that line feeds are used by default as row separators. Also notice that by default, leading and trailing spaces are removed from each field.