vb 组件的问题 请教

phying 2003-11-10 05:28:59
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
%>

错误

对象打开时,不能操作
...全文
36 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
phying 2003-11-11
  • 打赏
  • 举报
回复
提示错误如下:
对象打开时,不允许操作。
phying 2003-11-11
  • 打赏
  • 举报
回复
CityhunterID(城市猎人) :
你的方法在我发贴之前就试过了,不能
zqfleaf(动力港湾)
按照你的方法
oRS.CursorLocation = adUseClient
ors.open "select * from news where uName is null order by id desc",oconn
还是不行,
zqfleaf 2003-11-10
  • 打赏
  • 举报
回复
Set oRS = oConn.Execute("select * from news where uName is null order by id desc")
oRS.CursorLocation = adUseClient

改成:

oRS.CursorLocation = adUseClient
ors.open "select * from news where uName is null order by id desc",oconn
试试
CityhunterID 2003-11-10
  • 打赏
  • 举报
回复
BTW: 把这一行删除就应该没有什么问题了。
CityhunterID 2003-11-10
  • 打赏
  • 举报
回复
Set oRS = oConn.Execute("select * from news where uName is null order by id desc")
oRS.CursorLocation = adUseClient
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

这一行错了。

你在上面已经设置过了。这一行,因为 oRs 已经获得也结果集,所以会出错。
zqfleaf 2003-11-10
  • 打赏
  • 举报
回复
不知道是第一行的问题还是第二行的问题?ASP中可以看出来.
如果是第一行:
看你有没有注册成功
如果是第二行:
建议你用VB建一个组进行调试,调试成功后再把他编译成DLL

7,789

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧