ConnectorLib .NET 24.2

# Insert Records

After you have created a datastore table, you can add records to it:

           Record record = new Record();

           record["Reference"] = @"C:\data\file1.txt";

           record.Add("LastModified", new DateTime(
    		2013, 8, 05, 18, 05, 0, DateTimeKind.Utc));

           docs.Insert(record);

This example creates a record, sets values for each column, and inserts the record into the table created in Create Tables. You can set column values using the square brackets operator of the record. For convenience, there is also an `Add` method for setting DateTime and integer values. DateTimes and integers are converted to string representations automatically when you are setting the value of a text column. You can only set integers in a numeric column.

Although you can set any fields you like in the Record, an exception is thrown from the `Insert` method if you try to set fields that are not in the table.

You can create a record and insert it in a single statement, like this:

           docs.Insert(new Record()
    		.Add("Reference", @"C:\data\file2.txt")
    		.Add("LastModified", new DateTime(
    			2013, 7, 30, 14, 36, 0, DateTimeKind.Utc)));

Copyright 2024 Open Text
Version 24.2 | Last updated March 2024

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: IDOL ConnectorLib .NET 24.2

Topic Title: Insert Records