麻烦.sdf数据库的连接字符串

时间:2013-03-22 23:50:28

标签: c# asp.net sql-server-ce

无法连接到.sdf(SQL Server CE)数据库。

此代码给出了错误

  

路径无效。检查数据库的目录。

代码:

@using System;
@using System.IO;
@using System.Text;
@using System.Data;
@using System.Data.SqlServerCe;
@using System.Collections;
@using System.Data.Common;
@{
SqlCeConnection connection = new SqlCeConnection("Data Source=C:\\Users\\Blahblah\\Documents\\My Web Sites\\App_Data\\Pagelist.sdf;Persist Security Info=False;");
SqlCeCommand command = new SqlCeCommand("SELECT * FROM pageinfo WHERE PageID=1",connection);
connection.Open();

///etc. etc...

connection.Close();
}

0 个答案:

没有答案