1.<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%><%dim dbconst DatabaseType="ACCESS" db="data/cnhww.mdb" On Error Resume Next dim ConnStr dim conn ConnStr = "正链Provider = Sqloledb; User ID = (MSSQL账号); Password = (MSSQL密码); Initial Catalog = (MSSQL数据库); Data Source = localhost(MSSQL地址,本地可以不用改);" ' ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db) Set conn = Server.CreateObject("ADODB.Connection") conn.Open connstr If Err Then err.Clear Set Conn = Nothing Response.Write "数据库连接出错,请检查Conn.asp文件中的数据库参数设置。" Response.End End Ifsub CloseConn() On Error Resume Next If IsObject(Conn) Then conn.close set conn=nothing end ifend sub%>2.第2个在admin文件里 <%dim dbconst DatabaseType="ACCESS" db="../data/cnhww.mdb" On Error Resume Next dim ConnStr dim conn 'ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db) ConnStr = "Provider = Sqloledb; User ID = (MSSQL账号); Password = (MSSQL密码); Initial Catalog = (冲祥MSSQL数据库); Data Source = localhost(MSSQL地址,本地可以不用改);" Set conn = Server.CreateObject("ADODB.Connection") conn.Open connstr If Err Then err.Clear Set Conn = Nothing Response.Write "散清搏数据库连接出错,请检查Conn.asp文件中的数据库参数设置。" Response.End End Ifsub CloseConn() On Error Resume Next If IsObject(Conn) Then conn.close set conn=nothing end ifend sub%>3.第3个在pay文件夹里<%db="../bbs/data/cnhww.mdb" Set conn = Server.CreateObject("ADODB.Connection")connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&db&"")conn.Open connstr%>
相关文章
-
SQL和MySQL有什么区别?
2023-07-07 12:40 阅读(595) -
SQL数据库插入语句
2023-06-29 13:20 阅读(581) -
sql查询 身份证判断男女
2023-06-12 17:38 阅读(544)
1 SQL是什么?
624 阅读
2 sql文件怎么打开
648 阅读
3 ASP留言板问题
655 阅读
4 ASP中怎么让textbox控件显示密码字符
644 阅读
5 SQL sever是什么?
579 阅读