Public Sub conn1()
Dim DBpath, Connstr, conn As String
DBpath = "db.mdb"
Connstr = "Provider=Microsoft.JET.OLEDB.4.0;DATA Source=" & mServer.MapPath(DBpath)
Set conn = mServer.CreateObject("ADODB.Connection")
conn.open Connstr
End Sub说conn没有定义好
求助啊
Dim DBpath, Connstr, conn As String
DBpath = "db.mdb"
Connstr = "Provider=Microsoft.JET.OLEDB.4.0;DATA Source=" & mServer.MapPath(DBpath)
Set conn = mServer.CreateObject("ADODB.Connection")
conn.open Connstr
End Sub说conn没有定义好
求助啊
解决方案 »
- 如何保存RichTextBox多行内容
- 用VB制作半透明的窗体,同时桌面上的东西可以运用,其它程序也可以运用,急,谢谢各位!!!!!
- 怎么判断窗体失去焦点了?
- 如何判断一个字符串在另外一个里面?(在线等,解决就散分!)
- 汉语拼音标注格式输出
- 关于wise installer的问题,急啊!傍晚交项目,就命啊!在线等
- 我想要VB6的全部内部函数以及它的说明,提供者还有分相送
- 为什么ListView的mousedown事件对左键无响应?
- 有个作过XP风格的窗体吗?急!
- how to get the curren coordinates of form position.thanks
- 请高手看一下,这个错误怎么回事:File LICENSE.DAT not found. License Agreement can not be complete
- 把一个工程生成exe文件以后,里面的datagrid上显示不出来数据了,请教大家了,这是为何?
Private mContext As ScriptingContext
Private mApplication As Application
Private mResponse As Response
Private mRequest As Request
Private mSession As Session
Private mServer As Server
' ------------------------------------------' 接收ScriptingContext对象
' 初始化各个ASP对象
Public Sub OnStartPage(PassedScriptContext As ScriptingContext)
' Asp运行环境对象
Set mContext = PassedScriptContext
' Asp 五大对象
Set mApplication = mContext.Application
Set mRequest = mContext.Request
Set mResponse = mContext.Response
Set mServer = mContext.Server
Set mSession = mContext.Session
End Sub' 释放内部对象
Public Sub OnEndPage()
Set mApplication = Nothing
Set mRequest = Nothing
Set mResponse = Nothing
Set mServer = Nothing
Set mSession = Nothing
Set mContext = Nothing
End SubPublic Sub conn1()
Dim DBpath, Connstr, conn As String
DBpath = "db.mdb"
Connstr = "Provider=Microsoft.JET.OLEDB.4.0;DATA Source=" & mServer.MapPath(DBpath)
Set conn = mServer.CreateObject("ADODB.Connection")
conn.open Connstr
End Sub全部代码写出来了
帮忙看看
Option Explicit
Public ConnString As String
Public iPage As Integer
Public PageSize As Integer
Public bbsid As Integer
Public Deep As Integer
Public UserId As String
Public UserName As String
Public Groupid As Integer
Public Title As String
'Public Time As Date
Public Best As Integer
Public Faceid As Integer
Public IsEmail As Integer
Public BBs_content As String
Public ArrayCount As Integer
Public ArrayItem As Integer
Dim Conn As New ADODB.Connection
Public Sub DataConn()
Conn.Open ConnString
Conn.CommandTimeout = 300
Conn.CursorLocation = adUseClient
End Sub
Public Sub DisDataConn()
Set Conn = Nothing
End SubPublic Function List() As Variant On Error GoTo ErrorTrap
Dim Rs As New ADODB.Recordset
Dim Rs1 As New ADODB.Recordset
Dim Str_Sql As String
Dim BBS_Count As Integer
Dim i As Integer
Dim Size As Integer
Dim bbs_list()
Str_Sql = "Select count(*) From bbs "
Str_Sql = Str_Sql & " Where groupid = " & Groupid
If Best = 1 Then
Str_Sql = Str_Sql & " And Best = 1 "
End If
Set Rs1 = Conn.Execute(Str_Sql)
BBS_Count = Rs1(0)
'Rs1.Close
Set Rs1 = Nothing
Str_Sql = "Select bbsid,deep,userid,username,groupid,Title,time,see,best,faceid,isemail "
Str_Sql = Str_Sql & " From bbs "
Str_Sql = Str_Sql & " Where groupid = " & Groupid
If Best = 1 Then
Str_Sql = Str_Sql & " And Best = 1 "
End If
Str_Sql = Str_Sql & " order by RootId + BBSid - Sign(RootId) * BBSid desc,ordernum "
Rs.CursorLocation = adUseClient
Rs.Open Str_Sql, Conn, 1
Rs.PageSize = PageSize
If iPage <= 0 Then
iPage = 1
Else
If iPage > Rs.PageCount Then
iPage = Rs.PageCount
End If
End If
If BBS_Count > 0 Then
If BBS_Count < PageSize * iPage Then
Size = BBS_Count - PageSize * (iPage - 1)
Else
Size = PageSize
End If
ArrayCount = Size
ArrayItem = 11
ReDim bbs_list(Size - 1, 10)
Rs.AbsolutePage = iPage
For i = 0 To Size - 1
If Rs.EOF Then Exit For
bbs_list(i, 0) = Rs("bbsid")
bbs_list(i, 1) = Rs("deep")
bbs_list(i, 2) = Rs("userid")
bbs_list(i, 3) = Rs("username")
bbs_list(i, 4) = Rs("groupid")
bbs_list(i, 5) = Rs("title")
bbs_list(i, 6) = Rs("time")
bbs_list(i, 7) = Rs("see")
bbs_list(i, 8) = Rs("best")
bbs_list(i, 9) = Rs("faceid")
bbs_list(i, 10) = Rs("isemail")
Rs.MoveNext
Next
Set Rs = Nothing
Else
ArrayCount = 0
ArrayItem = 0
End If
List = bbs_list
'MsgBox ("Succeed")
Exit Function
ErrorTrap:
ArrayCount = 0
ArrayItem = 0
End Function
这样当然没定义好,又是一个“眼花”。
赋值的是:Connstr = "....."
晕...