I am using the following code to get data from my database and send to my handsontable grid.
public JsonResult getACLog()
{
var log = new List<ACLog>();
OdbcCommand command = new OdbcCommand("SELECT fldPrimaryKey, fldCall, fldDateStr, fldTimeOnStr, fldMode, fldState, fldRstR, fldRstS, fldBand FROM tblContacts;");
using (OdbcConnection connection = new OdbcConnection("Driver={Driver do Microsoft Access (*.mdb)};dbq=C:\\Users\\User\\MasterLog.mdb;defaultdir=C:\\Users\\User;driverid=25;fil=MS Access;filedsn=C:\\Users\\User\\MasterLog.mdb.dsn;maxbuffersize=2048;maxscanrows=8;pagetimeout=5;safetransactions=0;threads=3;uid=admin;usercommitsync=Yes"))
{
command.Connection = connection;
connection.Open();
using (var reader = command.ExecuteReader())
{
while (reader.Read())
{
var logger = new ACLog();
logger.box = "false";
logger.fldPrimaryKey = (reader.SafeGetInt(0).ToString());
logger.fldCall = reader.SafeGetString(1);
logger.fldDateStr = reader.SafeGetString(2);
logger.fldTimeOnStr = reader.SafeGetString(3);
logger.fldMode = reader.SafeGetString(4);
logger.fldState = reader.SafeGetString(5);
logger.fldRstR = reader.SafeGetString(6);
logger.fldRstS = reader.SafeGetString(7);
logger.fldBand = reader.SafeGetString(8);
log.Add(logger);
}
};
}
//return log;
return Json(log, JsonRequestBehavior.AllowGet);
}
When I do a debug session, it shows all the correct data in the log variable but my I get a popup box saying "localhostXXXX says error". Is my code correct or is the problem with the handsontable?
Not sure what to do.