Dim rst as adodb.recordset为什么不变化?

hjb111 2003-05-06 02:51:21
我装了vb6

当我输入dim rst as adodb.recodset发现列表中没有adodb,为什么?在哪里能找到?
...全文
98 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
online 2003-05-06
  • 打赏
  • 举报
回复
工程--->引用---->microsoft activex data object 2.5
maskzha 2003-05-06
  • 打赏
  • 举报
回复
工程--->引用---->microsoft activex data object 2.5
CityhunterID 2003-05-06
  • 打赏
  • 举报
回复
同意楼上的说。
lihonggen0 2003-05-06
  • 打赏
  • 举报
回复
笔误

工程--->引用---->microsoft activex data object 2.5
lihonggen0 2003-05-06
  • 打赏
  • 举报
回复
部件--->引用---->microsoft activex data object 2.5
大智 Kevin 2003-05-06
  • 打赏
  • 举报
回复
ADO 需要在引用中加在,或者用creatobject() 建立。一般是在projcet->references里加载microsoft activex date object2.5。
之后:
dim rst as adodb.recordset
set rst = new adodb.recordset

SQL+VB做成的licit Public gUserName As String Public gUserKind As String Public gEmployeeId As String Public gLoginSucceeded As Boolean Public Const BLUE = &HFF0000 Public Const WHITE = &H80000005 Sub Main() Dim fLogin As New frmLogin '启动登录窗体 fLogin.Show vbModal '装入并显示模式窗体。 If Not gLoginSucceeded Then MsgBox "系统启动失败,请重试!", vbOKOnly + vbExclamation, "警告" End If Unload fLogin End Sub Public Function ConnectString() As String ConnectString = "Provider=SQLOLEDB.1;Password=sa;User ID=sa;Initial Catalog=DBManPower;Data Source=127.0.0.1;" End Function Public Function ExecuteSQL(ByVal SQL As String, rst As ADODB.Recordset, _ Optional enableWrite As Boolean = True) As Boolean Dim con As ADODB.Connection Dim sTokens() As String On Error GoTo Execute_Error sTokens = Split(SQL) Set con = New ADODB.Connection con.Open ConnectString '打开数据库 Set rst = New ADODB.Recordset If enableWrite Then '读写方式 rst.Open Trim$(SQL), con, adOpenStatic, adLockOptimistic Else '只读方式 rst.Open Trim$(SQL), con, adOpenStatic, adLockReadOnly End If ExecuteSQL = True Exit Function Execute_Error: ExecuteSQL = False Exit Function End Function Public Function DBExist(ByVal SQL As String) As Integer Dim con As ADODB.Connection Dim sTokens() As String Dim flag As String Dim rst As ADODB.Recordset sTokens = Split(SQL) Set con = New ADODB.Connection con.Open ConnectString flag = ExecuteSQL(SQL, rst, False) '判断该记录是否存在 If rst.RecordCount <> 0 Then DBExist = rst.RecordCount Else DBExist = 0 End If con.Close End Function Public Function txtIsNull(txt As TextBox) As Boolean If Trim(txt.Text) = "" Then txtIsNull = True txt.SetFocus txt.BackColor = BLUE Else txtIsNull = False End If
vb学生管理系统源代码 部分代码 Public UserName As String Public txtSQL As String 'use to store record SQLsentence Public dream As ADODB.Recordset 'use to store record object Public Msgtext As String '用来存放返回信息 Public OK As Boolean ' 'Public db As String Public Sub highlight() With Screen.ActiveForm If (TypeOf .ActiveControl Is TextBox) Then .ActiveControl.SelStart = 0 .ActiveControl.SelLength = Len(.ActiveControl) End If End With End Sub Sub Main() 'Dim Login As New Login 'Login.Show vbModal 'f Not Login.OK Then 'Login Failed so exit app ' End 'End If 'Unload studentmdi ' Set login = New login login.Show End Sub Public Function connectstring() As String connectstring = "Provider=Microsoft.jet.OLEDB.3.51;Data source=f:\schoolgroup\school.mdb" End Function Public Function ExecuteSQL(ByVal SQL As String, Msgstring As String) As ADODB.Recordset Dim cnn As ADODB.Connection Dim rst As ADODB.Recordset Dim sTokens() As String On Error GoTo ExecuteSQL_Error sTokens = Split(SQL) Set cnn = New ADODB.Connection cnn.Open connectstring If InStr("INSERT,DELETE,UPDATE", UCase$(sTokens(0))) Then cnn.ExecuteSQL Msgstring = sTokens(0) & "query successful" Else Set rst = New ADODB.Recordset rst.Open Trim(SQL), cnn, adOpenKeyset, adLockOptimistic Set ExecuteSQL = rst Msgstring = "查询到" & rst.RecordCount & " 条记录" End If executeSQL_exit: Set rst = Nothing Set cnn = Nothing Exit Function ExecuteSQL_Error: Msgstring = "查询错误:" & err.Description Resume executeSQL_exit End Function Public Function Testtxt(txt As String) As Boolean If Trim(txt) = "" Then Testtxt = False Else Testtxt = True End If End Function

7,762

社区成员

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

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