Hi everyone,
I'm a senior student, and currently doing my graduation design using Revit. I wrote an addin to load data from Access .mdb file, and do some calculation and drawing after that.
My program works just fine on my work computer in the lab, always. But when I move it to my laptop, it crashed, right when the code runs to OleDbConnection .open().
The first time I send the error report, it gives me a solution that I might need to install a sp or something, I did that, and it still crashs every time, same place.
The environment of these two computers are almost the same, both windows 10 x64, revit 2016, office 2016, with access database engine 2010 x64 for my x64 addin. It works just fine on my work computer, but always crashs on my laptop.
I've spent like three or four hours trying to find out what's wrong... maybe someone here can help solve my problem.
Thanks!
Here's part of my codes, where things went wrong:
OleDbConnection mycon = null; OleDbDataReader myReader = null; int counting = 0; try { string strcon = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Users\\E\\Desktop\\MDB\\test.mdb;"; mycon = new OleDbConnection(strcon); mycon.Open(); string sql = "select * from testTable "; OleDbCommand mycom = new OleDbCommand(sql, mycon); myReader = mycom.ExecuteReader(); counting = 0; while (myReader.Read()) { rawData.tableRailRaw[counting].id = myReader.GetInt32(0); rawData.tableRailRaw[counting].serial = myReader.GetString(1); rawData.tableRailRaw[counting].ref_rail_id = myReader.GetString(2); rawData.tableRailRaw[counting].uid = myReader.GetString(15); counting++; } } finally { myReader.Close(); mycon.Close(); }