SQL connection string for microsoft access 2010 .accdb

后端 未结 4 1688
-上瘾入骨i
-上瘾入骨i 2020-12-03 15:46

I am doing a simple login form using winforms and access 2010 database (.accdb) in C#.

I have the following code and it seems that the connection string is wrong. I

4条回答
  •  没有蜡笔的小新
    2020-12-03 16:34

    For Acces databases (.mdb, .accdb, etc...), you want to use OleDbConnection, not SqlConnection (SQL Server), like this:

    conn = new System.Data.OleDb.OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\BC207\test.accdb")
    

提交回复
热议问题