Open topic with navigation

# 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)));

© 2018 Micro Focus or one of its affiliates | Send documentation feedback to Micro Focus Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a web mail client, and send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm