Winform在Internet上连接数据库

问题描述:

我购买了主机和域名,如何将桌面应用程序连接到我上传到主机的数据库?

I bought a hosting and domain, how to connect my desktop application to the database i uploaded to my hosting?

string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= http://www.sampledomain.com/database.mdb ;Jet OLEDB:Database Password=password";

System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(connectionString); 
System.Data.OleDb.OleDbCommand cmd = conn.CreateCommand();



错误显示它不是有效的文件名.请帮助,提前感谢=)



Error show it''s not a valid file name. please help,thanks in advance =)

您不能为此使用Access数据库. Access是一个基于文件的数据库,因此仅适用于文件路径(基于驱动器盘符或UNC路径),而不能通过HTTP或任何其他协议使用.

为了做到这一点,您将必须使用托管公司提供的任何数据库引擎,例如SQL Server.

最重要的是,如果托管公司将SQL Server直接公开到Internet,则您将只能连接到数据库.
You cannot use an Access database for this. Access is a file-based database and hence, will only work with file paths(be it drive letter based or UNC paths), not over HTTP or any other protocol.

In order for you to do this, you''ll have to use whatever database engine your hosting company supplies, such as SQL Server.

On top of all this, you''ll only be able to connect to your database IF the hosting company exposes the SQL Server directly to the Internet.


在这里

Access的连接字符串 [ ^ ] @ www.connectionstrings.com [ Access 2007的连接字符串 [
Here you go

Connection strings for Access[^] @ www.connectionstrings.com[^]

Also check Connection strings for Access 2007[^]


您是否双重确定该文件存在?
Are you double-damn sure that the file exists?