MSSQLset conn=server.createobject("adodb.connection")
conn.open "driver={sql server};description=sqldemo;server=服务器;uid=用户;pwd=密码;database=数据库"
If Err Then
err.Clear
Set conn = Nothing
Response.Write "数据库连接出错,请检查连接字串。"
Response.End
End If
set rs=server.createobject("adodb.recordset")
'关闭数据库连接
sub Closeconn()
'On Error Resume Next
conn.close
set conn=nothing
end sub
ORACLE用OracleClient连接
cnn.ConnectionString = "Persist Security Info=False;User ID=system;Password=manager;Data Source=ora9 ";
cnn.Open();
//ora9是数据库名称 //manager是密码//system是用户名
用OleDb连接
cnn.ConnectionString= "Provider=MSDAORA;Password=密码;User ID=用户名;Data Source=数据库名称";
cnn.Open();
取消
评论