+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Bulk import csv use nolics or not

Bulk import csv use nolics or not

2 posts, 0 answered
  1. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    22 Sep 2010
    Link to this post
    Hi team,

    I need to make one important adjust importing more that 200k lines inside a nolics class in sf project (no module but extra content). What are the best logical to proceed in this way?. I can use a StreamReader line by line and create one transaction by line or use bulk import directly in the table. If i use a streamreader how i can point the item columns?
    thanks.

    string[] data = line.Split('|');
    if (data.Length > 0)
    {
        Transaction transaction = new Transaction();
            JOB item = new JOB();
            OdbClass.Create(item, transaction);
            item.ID = (string)data[0];                
        //...many items
        /*
        no way to point one row or directly import all?
        item[0]= ??
        or import a Dataset
        DataRow row = dt.NewRow();
        row.ItemArray = data;
        dt.Rows.Add(row);
        */
        transaction.Commit();   
    }
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    23 Sep 2010
    Link to this post
    Hi Pierre,

    You have to upload your data on chunks where each piece will be about 1 MB. You will read the file depending on the chunks size and the make transactions to the database.

    var chunkSize = 1048576; // 1MB.
    var buffer = new byte[chunkSize];
    int bytesRead = buffer.Length;

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered