数据库连接问题,请大侠指导!
<script language="vb" runat="server">sub page_load(Source As object,E as EventArgs)
dim strconnection as string ="server=D31XQQ1X;database=master;" & _
"integrated security=true;"
dim objconnection as new sqlconnection(strconnection)
dim strsql as string ="select name,age from table1"
dim objcommand as new sqlcommand(strsql,objconnection)
objconnection.open()
dgnamelist.datasource=objcommand.executereader()
dgnamelist.databind()
objconnection.close()
end sub
</script>
用的是msde,在服务器资源管理器中,已经测试连通了,但运行后爆错如下:
用户 'D31XQQ1X\ASPNET' 登录失败。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.Data.SqlClient.SqlException: 用户 'D31XQQ1X\ASPNET' 登录失败。
源错误:
行 27: dim strsql as string ="select name,age from table1"
行 28: dim objcommand as new sqlcommand(strsql,objconnection)
行 29: objconnection.open()
行 30: dgnamelist.datasource=objcommand.executereader()
行 31: dgnamelist.databind()
请教各位大侠教教我这个小鸟