实例介绍
【实例简介】
【实例截图】内附说明
【核心代码】
VERSION 5.00 Begin VB.Form Form5 Caption = "按名查找" ClientHeight = 4950 ClientLeft = 60 ClientTop = 420 ClientWidth = 6450 LinkTopic = "Form5" ScaleHeight = 4950 ScaleWidth = 6450 StartUpPosition = 3 'Windows Default Begin VB.CommandButton Command2 Caption = "清除" BeginProperty Font Name = "宋体" Size = 15.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 375 Left = 2040 TabIndex = 17 Top = 4440 Width = 2295 End Begin VB.TextBox Text8 BeginProperty Font Name = "宋体" Size = 15.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 975 Left = 1200 TabIndex = 16 Top = 3360 Width = 5055 End Begin VB.TextBox Text7 BeginProperty Font Name = "宋体" Size = 15.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 375 Left = 1560 TabIndex = 14 Top = 2880 Width = 4095 End Begin VB.TextBox Text6 BeginProperty Font Name = "宋体" Size = 15.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 375 Left = 1560 TabIndex = 12 Top = 2160 Width = 4095 End Begin VB.TextBox Text5 BeginProperty Font Name = "宋体" Size = 15.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 375 Left = 1560 TabIndex = 10 Top = 1560 Width = 4095 End Begin VB.TextBox Text4 BeginProperty Font Name = "宋体" Size = 15.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Left = 5040 TabIndex = 8 Top = 240 Width = 975 End Begin VB.TextBox Text3 BeginProperty Font Name = "宋体" Size = 15.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Left = 4200 TabIndex = 7 Top = 840 Width = 1815 End Begin VB.TextBox Text2 BeginProperty Font Name = "宋体" Size = 15.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Left = 1080 TabIndex = 5 Top = 840 Width = 1815 End Begin VB.CommandButton Command1 Caption = "查找" BeginProperty Font Name = "宋体" Size = 15 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Left = 3120 TabIndex = 2 Top = 240 Width = 975 End Begin VB.TextBox Text1 BeginProperty Font Name = "宋体" Size = 15.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Left = 1080 TabIndex = 0 Top = 240 Width = 1815 End Begin VB.Label Label8 AutoSize = -1 'True Caption = "描述" BeginProperty Font Name = "宋体" Size = 15.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Left = 240 TabIndex = 15 Top = 3480 Width = 630 End Begin VB.Label Label7 AutoSize = -1 'True Caption = "家庭住址" BeginProperty Font Name = "宋体" Size = 15.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Left = 120 TabIndex = 13 Top = 2880 Width = 1260 End Begin VB.Label Label6 AutoSize = -1 'True Caption = "电子邮件" BeginProperty Font Name = "宋体" Size = 15.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Left = 120 TabIndex = 11 Top = 2160 Width = 1260 End Begin VB.Label Label5 AutoSize = -1 'True Caption = "联系方式" BeginProperty Font Name = "宋体" Size = 15.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Left = 120 TabIndex = 9 Top = 1560 Width = 1260 End Begin VB.Label Label4 AutoSize = -1 'True Caption = "关系" BeginProperty Font Name = "宋体" Size = 15.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Left = 3240 TabIndex = 6 Top = 960 Width = 630 End Begin VB.Label Label3 AutoSize = -1 'True Caption = "性别" BeginProperty Font Name = "宋体" Size = 15.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Left = 120 TabIndex = 4 Top = 960 Width = 630 End Begin VB.Label Label2 AutoSize = -1 'True Caption = "年龄" BeginProperty Font Name = "宋体" Size = 15.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Left = 4200 TabIndex = 3 Top = 240 Width = 630 End Begin VB.Label Label1 AutoSize = -1 'True Caption = "姓名" BeginProperty Font Name = "宋体" Size = 15.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Left = 120 TabIndex = 1 Top = 240 Width = 630 End End Attribute VB_Name = "Form5" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Sub Command1_Click() Dim Rst As New ADODB.Recordset Dim Conn As ADODB.Connection Dim i As Long Dim MsgStr As String Set Conn = CreateObject("ADODB.Connection") Set Conn = New ADODB.Connection Conn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=通讯录;DataSource=MADFROG" Conn.Open MsgStr = "select * from 通讯成员 where 姓名='" & Trim(Text1) & "'" Rst.Open MsgStr, Conn, adOpenKeyset, adLockOptimistic If Rst.BOF And Rst.EOF Then MsgBox "不存在该通讯成员!", vbInformation GoTo LooseMrc End If With Rst Text2.Text = .Fields("性别") Text3.Text = .Fields("关系") Text4.Text = .Fields("年龄") Text5.Text = .Fields("联系方式") Text6.Text = .Fields("电子邮件") Text7.Text = .Fields("家庭住址") Text8.Text = .Fields("描述") End With LooseMrc: Set Rst = Nothing Set Conn = Nothing End Sub Private Sub Command2_Click() Call ClearForm End Sub Private Sub Form_Unload(Cancel As Integer) Form2.Enabled = True End Sub Private Sub CmdExit_Click() Unload Me Form2.Enabled = True End Sub Sub ClearForm() Text1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" Text5.Text = "" Text6.Text = "" Text7.Text = "" Text8.Text = "" End Sub
好例子网口号:伸出你的我的手 — 分享!
网友评论
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
支持(0) 盖楼(回复)