asp-classic – 与SQL Server Compact Edition 4.0的Ado连接

我想从旧的asp-classic网站连接到sql Server Compact Edition 4.0,但我总是得到错误

“Microsoft OLE DB Provider for ODBC Drivers error’80004005′
[Microsoft] [ODBC驱动程序管理器]未找到数据源名称且未指定认驱动程序. “

我试过了

sCon = "Data Source=c:\temp\sqlcompact.sdf;Encrypt Database=True;Password=testtest;Persist Security Info=False;"

更新:
错误:多步OLE DB操作生成错误.检查每个OLE DB状态值(如果可用).没有工作

sCon = "Provider=Microsoft.sqlSERVER.CE.OLEDB.4.0;Data Source=c:\temp\sqlcompact.sdf;Password=testtest;"

没有任何成功.

通常可以从ADO连接到sql Server CE 4.0吗?

更新:
示例代码
打开连接:

dim sCon

dim gCON : set gCON=CreateObject ("ADODB.Connection")

sCon = "Provider=Microsoft.sqlSERVER.CE.OLEDB.4.0;Data Source=c:\temp\sqlcompact.sdf;Pwd=testtest;"

gCon.ConnectionString = sCon
gCon.Open 
gCon.Close

解决方法

是的,您可以通过ADO连接到sql CE 4.
Set Cnxn = CreateObject("ADODB.Connection") 
Set cmd = CreateObject("ADODB.Command")
strCnxn = "Provider=Microsoft.sqlSERVER.CE.OLEDB.4.0;" & _ 
"Data Source=C:\nw40.sdf;" 
Cnxn.Open strCnxn 
cmd.ActiveConnection = Cnxn 
cmd.CommandText = "SELECT TABLE_NAME FROM informatION_SCHEMA.TABLES" 
While Not pRS.EOF 
   WScript.Echo pRS(0) 
   pRS.MoveNext 
wend

对于密码保护的文件,请使用:

strCnxn = "Provider=Microsoft.sqlSERVER.CE.OLEDB.4.0;" & 
 _ "Data Source=C:\nw40.sdf;ssce:database password=secret"

相关文章

### 创建一个gRPC服务项目(grpc服务端)和一个 webapi项目(...
一、SiganlR 使用的协议类型 1.websocket即时通讯协议 2.Ser...
.Net 6 WebApi 项目 在Linux系统上 打包成Docker镜像,发布为...
一、 PD简介PowerDesigner 是一个集所有现代建模技术于一身的...
一、存储过程 存储过程就像数据库中运行的方法(函数) 优点:...
一、Ueditor的下载 1、百度编辑器下载地址:http://ueditor....