DataTable Examples:
I’d like to use a data table as a multidimensional dynamic array inside ninja 7 but have been unable to implement it. Does anyone have any experience with this or another data structure that will store vars like excel? ( In columns and rows and is dynamic )
Initializing and storing vars in the table is no problem. Reading the data is a problem. The MSDN recommended syntax doesn’t work inside ninja.
using System.Data;
protected override void OnBarUpdate()
{
// Declare DataTable
DataTable table = new DataTable();
// Add columns
table.Columns.Add("Dosage", typeof(int));
table.Columns.Add("Drug", typeof(string));
table.Columns.Add("Patient", typeof(string));
table.Columns.Add("Date", typeof(DateTime));
// Add five DataRows.
table.Rows.Add(25, "Indocin", "David", DateTime.Now);
table.Rows.Add(50, "Enebrel", "Sam", DateTime.Now);
table.Rows.Add(10, "Hydralazine", "Christoff", DateTime.Now);
table.Rows.Add(21, "Combivent", "Janet", DateTime.Now);
table.Rows.Add(100, "Dilantin", "Melanie", DateTime.Now);
// no matter what syntax I try I'm unable to read the data
// Print(table.Rows[0][0]);
}
Westsider



Comment