Using collections

May 6, 2010 at 10:12 AM
Edited May 6, 2010 at 10:14 AM

I'm looking to see if Jint supports some server side scripting I need to do...

It looks like it would, however there is just one small, but important thing I cannot get to work - DataRow manipulation.

If I share an object with the jintengine that has a function which returns the rows from a datatable, Jint seems to believe that all the content cells are undefined as I try to access them.


public class QueryObject()
public DataRowCollection GetRows()
//Return some rows from DataTable

var _queryObject = new QueryObject();
_jintEngine.SetParameter("QueryObject", _queryObject);
_jintEngine.Run("var someRows = QueryObject.GetRows(); var oneCell = someRows[0][0];")

If I run the above, oneCell will always contain null.

Is there any way I could return the datarows that would make their values accessible in script?

Thank you.
May 7, 2010 at 9:17 AM

FYI, Mirtul got it working by using latest version from repository so this is no longer an issue for us.

May 30, 2010 at 9:45 PM


I think I have the same problem as described above. When I run the code below result is null.

var dt = new System.Data.DataTable();


var dr = dt.NewRow();
dr[0] = "1";
dr[1] = "rowval01";

var result = dt.Select("Key = '1'")[0]["Col01"]; / var result = dt.Select("Key = '1'")[0][1]; 

If if set result to be:

var result = dt.Select("Key = '1'")[0]

result is a DataRow but result["Col01"]/result[1] is still null.

I have tried with the latest code from repository and the released code.

->Mirtul, could you provide some more code of what you got to work?