我是Blazor的新手,目前,我要做的就是连接到Access数据库。
在网页加载之前,我收到一个未处理的异常,说System.Data.OleDb is not supported on this platform
。我已经安装了软件包和所有东西。
<button class="btn btn-primary" @onclick="ConnectToDb">Click me</button>
@msgstring
@code {
string msgstring = "Awaiting";
string connstr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Users\\user\\source\\repos\\app\\Database.accdb; Persist Security Info=False;";
OleDbConnection conn = new OleDbConnection();
void ConnectToDb()
{
conn.ConnectionString = connstr;
try
{
conn.Open();
msgstring = "Connected";
}
catch { msgstring = "Error"; }
}
}