本文介绍了如何在网络上为Windows应用程序连接MS访问数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在开发c#.net中的windows基础网络应用程序,想知道如何从网络或表单服务器连接ms访问数据库。
问候
Sujit Kesbhat
I am developing windows base network application in c# .net and wants to know how to connect ms access database from network or form server pc.
Regards
Sujit Kesbhat
推荐答案
string connString="Provider=Microsoft.Ace.OLEDB.12.0;DataSource=databasename.accdb";
public DataTable getAuthentication()
{
using (OleDbConnection con = new OleDbConnection(connString))
{
OleDbCommand cmd = new OleDbCommand("SELECT * FROM tableName", con);
DataTable dTable = new DataTable();
OleDbDataAdapter adapter = new OleDbDataAdapter(cmd);
adapter.SelectCommand = cmd;
adapter.Fill(dTable);
return dTable;
}
}
那么你可以在某个地方使用这个方法.. 。
Then you can use the method somewhere...
这篇关于如何在网络上为Windows应用程序连接MS访问数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!