Skip to Content
author's profile photo Former Member
Former Member

How to convert SBO RecordSet and DataTable to C# DataTable or DataSet.

Hello Expert.

I used to use below code to convert SBO RecordSet to C# DataTable :

public static System.Data.DataTable AddOnSetTableSboRS2NetDT(string tableName, SAPbobsCOM.Recordset oRecordSet)

{

string dtName = tableName.Trim().Length > 0 ? tableName.Trim() : "Table1";

System.Data.DataTable dataTable = new System.Data.DataTable(dtName);

foreach (SAPbobsCOM.Field field in oRecordSet.Fields)

dataTable.Columns.Add(field.Name, typeof(string));

while (!oRecordSet.EoF)

{

System.Data.DataRow row = dataTable.NewRow();

foreach (SAPbobsCOM.Field field in oRecordSet.Fields)

row[field.Name] = field.Value;

dataTable.Rows.Add(row);

oRecordSet.MoveNext();

}

return dataTable;

}

However, I think it is not good way to convert SBO RecordSet to C# DataTable.

Above code has a performance problem.

I have two questions :

1. Convert SBO RecordSet to C# DataTable

2. Convert SBO DataTable to C# DataTable

Does anybody have good experiences as I write above questions?

Have a good day and thank you for reading.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2014 at 12:39 AM

    Hi Chan,

    This is not the right forum...

    Answer is export in xml from side and import as xml on the other.

    Regards,

    Eric

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.