如何更正Access数据库的连接字符串? [英] How to correct the connection string of access database?

查看:89
本文介绍了如何更正Access数据库的连接字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更正访问数据库的连接字符串,它说未声明server.mappath.

How to correct the connection string of access database, it says that server.mappath is not declared.

Dim connectionString As String = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=" + Server.MapPath("database/counter.mdb")

推荐答案

您好,如果它是类库项目,那么您需要添加System.Web的引用.并将其用作

Hi if it is classlibrary project then you need to add reference of System.Web. and use it as

HttpContext.Current.Server.MapPath



希望获得帮助.



Hope this help.


确保服务类继承自System.Web.Services.Service.
没有这个,您将无法访问Server对象.
Make sure that the service class inherits from System.Web.Services.Service.
Without this you don''t have access to the Server object.


这篇关于如何更正Access数据库的连接字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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