首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

C#连接远程access数据库 出错解决办法

2012-06-09 
C#连接远程access数据库 出错相关代码:C# code string ip textBox2.TextOleDbConnection coon new Ol

C#连接远程access数据库 出错

相关代码:

C# code
 string ip = textBox2.Text;            OleDbConnection coon = new OleDbConnection("Provider=MS Remote;Remote Server=http://"+ip+";Remote Provider=Microsoft.Jet.OLEDB.4.0; Data Source=F:\\zhao-作业\\c# 作业1\\SZqq_sever\\SZqq_sever\\bin\\Debug\\SZqq用户登记库.mdb," + "admin," + "");            coon.Open();            string sql;            OleDbDataReader dr;            sql = "select * from user_mes";            OleDbCommand mycomm = new OleDbCommand(sql, coon);            dr = mycomm.ExecuteReader();            while (dr.Read())            {                string mima = dr["user_n"].ToString();                string miwen = dr["mima"].ToString();                textBox1.Text = mima + miwen;            }            dr.Close();



显示为:Internet 客户端错误:不能连接服务器

是怎么回事?应该如何应对?

[解决办法]
Data Source 后面跟的要是前面 http 地址能访问到的相对虚拟路径,而不是这样绝对路径

热点排行