mssql数据库连接程序
mssql数据库连接程序
on error resume next
response.buffer = true
dim startime
dim conn
dim connstr
dim sqldatabase,sql_pass_word,sql_user_id,sql_data_source
startime=timer()
set conn = server.createobject(adodb.connection)
connstr = provider=sqloledb.1;password='';persist security info=false;user id='sa';initial catalog='m1';data source='127.0.0.1'
conn.open connstr
'connstr = provider=sqloledb.1;integrated security=sspi;persist security info=false;data source=(local)
'conn.open connstr
'conn.defaultdatabase = dgjob
sub creaters(sql,lv1,lv2)
set rs=server.createobject(adodb.recordset)
rs.open sql,conn,lv1,lv2
end sub
function closedb
conn.close
set conn = nothing
end function
if err then
response.write & vbcrlf
response.write & vbcrlf
response.write 数据库连接出错,请检查连接字串。'注释,需要把这几个字翻译成英文。
err.clear
set conn = nothing
response.end
end if
function rsclose
set rs=nothing
end function
function connclose
conn.close
set conn=nothing
end function
%>
数据库连接出错,请检查连接字串。