3个回答
展开全部
Dim SqlDatabaseName,SqlPassword,SqlUsername,SqlLocalName,ConnStr,Cn
SqlDatabaseName = "yiwucci" 'SQL数据库名
SqlPassword = "yiwucci" 'SQL数据库用户密码
SqlUsername = "yiwucci" 'SQL数据库用户名
SqlLocalName = "(local)" 'SQL主机IP地址(本地可用“127.0.0.1”或“(local)”,非本机请用真实IP)
ConnStr = "Provider = Sqloledb; User ID = " & SqlUsername & "; Password = " & SqlPassword & "; Initial Catalog = " & SqlDatabaseName & "; Data Source = " & SqlLocalName & ";"
Set cn = Server.CreateObject("ADODB.Connection")
cn.open ConnStr
sub CloseConn()
cn.close
set cn=Nothing
Response.Write "数据库连接出错..."
Response.End
end Sub
SqlDatabaseName = "yiwucci" 'SQL数据库名
SqlPassword = "yiwucci" 'SQL数据库用户密码
SqlUsername = "yiwucci" 'SQL数据库用户名
SqlLocalName = "(local)" 'SQL主机IP地址(本地可用“127.0.0.1”或“(local)”,非本机请用真实IP)
ConnStr = "Provider = Sqloledb; User ID = " & SqlUsername & "; Password = " & SqlPassword & "; Initial Catalog = " & SqlDatabaseName & "; Data Source = " & SqlLocalName & ";"
Set cn = Server.CreateObject("ADODB.Connection")
cn.open ConnStr
sub CloseConn()
cn.close
set cn=Nothing
Response.Write "数据库连接出错..."
Response.End
end Sub
展开全部
什么是dw
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
楼主应该是找asp+vb连接sql数据库的.
二楼你给一个ASP.NET+VB.NET的算什么啊.
参考一下这个:
<%session.timeout=20
if not isobject(Conn) then
On Error Resume Next
Set Conn = Server.CreateObject("ADODB.Connection")
conn.open "Provider = Sqloledb;User ID=sa;Password=0000;Initial Catalog =text;Data Source =local"
else
response.write"连接数据库出错"
end if
%>
二楼你给一个ASP.NET+VB.NET的算什么啊.
参考一下这个:
<%session.timeout=20
if not isobject(Conn) then
On Error Resume Next
Set Conn = Server.CreateObject("ADODB.Connection")
conn.open "Provider = Sqloledb;User ID=sa;Password=0000;Initial Catalog =text;Data Source =local"
else
response.write"连接数据库出错"
end if
%>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询