vb 组件的问题 请教
Private ScriptingContext As ScriptingContext
Private Request As Request
Private Response As Response
Private Server As Server
Private Session As Session
Public Sub OnStartPage(PassedScriptingContext As ScriptingContext)
Set ScriptingContext = PassedScriptingContext
Set Request = ScriptingContext.Request
Set Response = ScriptingContext.Response
Set Server = ScriptingContext.Server
Set Session = ScriptingContext.Session
End Sub
Public Sub OnEndPage()
Set ScriptingContext = Nothing
Set Request = Nothing
Set Response = Nothing
Set Server = Nothing
Set Session = Nothing
End Sub
Public Function getConn() As String
getConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "/DataBase/mm.mdb"
End Function
Public Sub checkLogin()
On Error GoTo ErrHander
Dim uName As String
Dim uPass As String
Dim oConn As New ADODB.Connection
Dim oRS As New ADODB.Recordset
uName = Request.Form("uName")
uPass = Request.Form("uPass")
oConn.Open getConn
Set oRS = oConn.Execute("select * from userlist where uName='" & uName & "' and uPass = '" & uPass & "'")
If oRS.EOF Then
Response.Write "<script>alert('警告!\n 用户名或密码错误!');history.go(-1);</script>"
Else
Response.Write "<script>var w_width,w_height;w_width=window.screen.width-10;w_height=window.screen.height-40;</script>"
Response.Write "<script>window.open('main.asp','mm','top=0,left=1,width='+w_width+',height='+w_height);window,opener=null;self.close();</script>"
End If
ErrHander:
Response.Write Err.Description
End Sub
Public Sub showEveryNews()
On Error GoTo ErrHander
Dim oRS As New ADODB.Recordset
Dim oConn As New ADODB.Connection
oConn.Open getConn
oConn.Mode = adModeRead
oConn.CursorLocation = adUseClient
Set oRS = oConn.Execute("select * from news where uName is null order by id desc")
oRS.CursorLocation = adUseClient
If oRS.EOF Then
Response.Write "no"
Else
Response.Write "ok"
End If
ErrHander:
Response.Write Err.Description
End Sub
asp页面代码如下
<%
set showNews = server.CreateObject("Lem.basic")
showNews.showEveryNews
set showNews = nothing
%>
错误
对象打开时,不能操作