TimeSeriesLibrary.TSLibrary.XmlImportAndSaveToDB C# (CSharp) Method

XmlImportAndSaveToDB() public method

This method reads the given XML file and stores any time series that are defined in the XML file to the database using the given database connection number and database table name. Each time series is also stored in a new TSImport object that is addded to the given List of TSImport objects.
public XmlImportAndSaveToDB ( int connectionNumber, String tableName, String traceTableName, String xmlFileName, List tsImportList ) : int
connectionNumber int The serial number of the connection that is used to write to the database
tableName String The name of the database table that time series will be written to
traceTableName String The name of the database table that stores the BLOB for a single trace
xmlFileName String The file name (with path) of an XML file that defines one or more time series to import
tsImportList List A List of TSImport objects that the method adds to. One item is added to the List /// for each time series that is processed in the XML file. The List must already be instantiated before calling /// this method. The method does not change any items that are already in the List.
return int
        public int XmlImportAndSaveToDB(int connectionNumber, String tableName, String traceTableName,
                        String xmlFileName, List<TSImport> tsImportList)
        {
            // Get the connection that we'll pass along.
            SqlConnection connx = GetConnectionFromId(connectionNumber);
            // Construct new TSXml object with SqlConnection object and table name
            TSXml tsXml = new TSXml(connx, ConnxObject, tableName, traceTableName);
            // Method in the TSXml object does all the work
            return tsXml.ReadAndStore(xmlFileName, null, tsImportList, true, true);
        }