Winform在Internet上连接数据库 [英] winform connect database at internet

查看:75
本文介绍了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?


这篇关于Winform在Internet上连接数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆