日期:2014-05-16  浏览次数:20318 次

求救 必须js连接sql 连access已经成功 该如何实现?
求救   必须js连接sql   连access已经成功   该如何实现?
<%@language= "javascript "%>
<%
var   dbConn   =new   ActiveXObject( "adodb.connection ");
dbConn.Open( "Provider=Microsoft.Jet.OLEDB.4.0;Data   Source= "+Server.Mappath( "test.mdb "));
//dbConn.Open( "Provider=SQLOLEDB;   User   ID=test;   Password=test;   Initial   Catalog=test;   Data   Source=test ";);
%>
服务器端js   连接access成功,连接sql该如何?注释部分测试不可以

------解决方案--------------------
<%@language= "JSCRIPT "%>
<%
var dbConn =new ActiveXObject( "adodb.connection ");
dbConn.Open( "Provider=SQLOLEDB; User ID=test; Password=test; Initial Catalog=test; Data Source=(local); ");
%>

------解决方案--------------------
你要确保SQL Server的身份验证为混合验证
------解决方案--------------------
你要确保SQL Server的身份验证为混合验证,
还要保证数据库服务器是运行的,用户名密码是正确的,IP地址是正确的……

楼主还是把失败原因贴出来吧
------解决方案--------------------
运行下面的代码,看看什么错误

<%@LANGUAGE= "JSCRIPT " CODEPAGE= "936 "%>
<%
try
{
var dbConn =new ActiveXObject( "adodb.connection ");
dbConn.Open( "Provider=SQLOLEDB; User ID=test; Password=test; Initial Catalog=test; Data Source=(local); ");}
catch (e)
{
Response.Write(e.description)
}
%>
------解决方案--------------------
Jscript:
ACCESS:
OLEDB:
var conn= "Provider=Microsoft.Jet.OLEDB.4.0;persist security info=false;Data source= "+
Server.MapPath( "data/shawlqiu.mdb ");
MSSQL:
OLEDB:
var conn= "provider=sqloledb;data source=shawl;user id=unstr; password=pwdstr;persist security info=false;initial catalog=shawl "
Vbscript:
ACCESS:
OLEDB:
dim conn
conn = "Provider=Microsoft.Jet.OLEDB.4.0;Data source= "&Server.MapPath( "/Data/data.mdb ")
MSSQL:
OLEDB:
dim conn
conn= "provider=sqloledb;data source=shawl;user id=unstr; password=pwsstr;persist security info=false;initial catalog=shawl "


c# .net
public static string Conn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source= "+
@HttpContext.Current.Server.MapPath( "/data/#data.mdb ");