Hi there,
i need to read and write a mdb file from unity, my code works perfectly in unity 5.6 32 bit but don’t won’t to work in unity 2017.3.of3.
I need to get it working on unity 2017 because on 5.6 editor crashes as soon as i hit play.
here is the code:
using UnityEngine;
using System;
using System.Data.Odbc;
public class TestDb : MonoBehaviour
{
OdbcConnection dbconn;
OdbcCommand dbcmd;
OdbcDataReader reader;
private void Start()
{
string con = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" + Application.dataPath + "/StreamingAssets/Claudio.mdb;Uid=Admin;Pwd=1";
dbconn = new OdbcConnection(con);
try
{
dbconn.Open();
}
catch (Exception e)
{
Debug.Log(e.Message);
}
string query = "select * from tabella1";
dbcmd = new OdbcCommand(query,dbconn);
reader = dbcmd.ExecuteReader();
while (reader.Read())
{
Debug.Log(reader.GetString(0));
}
}
}
and here is the error on unity 2017:
ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
UnityEngine.Debug:Log(Object)
TestDb:Start() (at Assets/TestDb.cs:21)