Skip to main content

Hey guys. This code was converted in https://cs2cobol.microfocuscloud.com/ but it is showing an error on the following line:

C#

DataTable objDataTable = new DataTable();
objDataTable.Columns.Add("Student Id", typeof(int));
objDataTable.PrimaryKey = new DataColumn[] { objDataTable.Columns["Student Id"] };

VC

 
What would be the correct syntax?
Thanks

Hey guys. This code was converted in https://cs2cobol.microfocuscloud.com/ but it is showing an error on the following line:

C#

DataTable objDataTable = new DataTable();
objDataTable.Columns.Add("Student Id", typeof(int));
objDataTable.PrimaryKey = new DataColumn[] { objDataTable.Columns["Student Id"] };

VC

 
What would be the correct syntax?
Thanks

I think you would just get rid of the "table of object" so it reads:

set objDataTable::PrimaryKey to table of type DataColumn(objDataTable::Columns["Student Id"])


I think you would just get rid of the "table of object" so it reads:

set objDataTable::PrimaryKey to table of type DataColumn(objDataTable::Columns["Student Id"])

Thanks Chris. It worked.