C# 连接ACCESS为什么错误???绝对路经写错了吗?
OleDbConnection old = new OleDbConnection(@ "Provider=Microsoft.Jet.OLEDB.4.0;Password= " " " ";User ID=Admin;Data Source= "+Server.MapPath( " ")+ "\\ "+ "database\\test.mdb ");
string sql = "select * from table1 ";
OleDbDataAdapter oda = new OleDbDataAdapter(sql,old);
DataTable dt = new DataTable();
F:\WindowsApplication1\Form1.cs(452):
找不到类型或命名空间名称“Server”(是否缺少 using 指令或程序集引用?)
是C/S程序
绝对路经怎么写啊
------解决方案--------------------using System;
using System.Data;
using System.Data.OleDb;
using System.Web;
using System.Web.UI;
------解决方案--------------------Server.MapPath是用在Web应用程序中的。
------解决方案-------------------- <appSettings>
<!--
connStr参数设置,事例说明:
(1)Sql server数据库,例如“server=local;database=test;uid=sa;pwd=;”
(2)Access数据库,例如 "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|WebSeven.mdb "
-->
<add key= "connStr " value= "server=127.0.0.1;database=DbName;uid=sa;pwd=; " />
</appSettings>
------解决方案--------------------路径@ "c:\\*\\database\\test.mdb ") "
*是你自己的路径