visual studio 2010 - Alternate solution of Microsoft.Jet.OLEDB.4.0 provider for x64 bit version -
i saving values access database , used microsoft.jet.oledb.4.0 provider , have configure platform mode cpu x86 in project in visual studio , works fine x86 platform when start unit testing using nunit not accepting x86 platform , nunit shows error
"unittest_finance.test.class1.insertcashpayment: system.invalidoperationexception : 'microsoft.jet.oledb.4.0' provider not registered on local machine."
now want alternative way handle error while performing unit testing using nunit.
here code reference
class repairdll { string dbconn = "provider=microsoft.jet.oledb.4.0;data source=c:/autorepairdb.mdb"; //method booking value public virtual bool insert_data_repair_history(entityclass ec) { bool isinsert = false; //connect database oledbconnection connection = new oledbconnection(dbconn); connection.open(); try { //insert customer value string sql = "insert [repair_history] (firstname,lastname,city,state,vehicleno,lienseno,repairdate,summary,charge) " + "values ('" + ec.r_firstname + "','" + ec.r_lastname + "','" + ec.r_city + "','" + ec.r_state + "','" + ec.r_vehicleno + "','" + ec.r_licenseno + "','" + ec.r_date + "','" + ec.r_summary + "','" + ec.r_charge + "')"; oledbcommand command = new oledbcommand(sql, connection); command.executenonquery(); connection.close(); isinsert = true; } catch { throw new exception(); } { // close connection if (connection != null) { connection.close(); } } return isinsert; } }
there no 64-bit version of jet database engine, 64-bit applications have use 64-bit version of access database engine (ace), , invoke this
provider=microsoft.ace.oledb.12.0;
there 32-bit version of ace, applications use ace work in both 32-bit , 64-bit environments. note jet deprecated new applications.
Comments
Post a Comment