您好,欢迎光临本网站![请登录][注册会员]  
文件名称: VB电子相册
  所属分类: 讲义
  开发工具:
  文件大小: 5mb
  下载次数: 0
  上传时间: 2015-06-14
  提 供 者: wm52****
 详细说明: VB电子相册 电子相册 1、数据库连接 Public conn As ADODB.Connection Public Sub conDB() Set conn = New ADODB.Connection conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _ & App.Path & "\data\pic.mdb" conn.Open End Sub 2、登录模块 Dim loginTimes As Integer Private rsmc As ADODB.Recordset Private rs As ADODB.Recordset Public userName As String Private Sub cmdExit_Click() Unload Me End Sub Private Sub cmdOK_Click() Call login End Sub Private Sub Form_Activate() Call c onDB Set rsmc = New ADODB.Recordset rsmc.CursorLocation = adUseClient rsmc.Open "用户信息表", conn, 0, 1 'need to learn cbUserName.Clear While Not rsmc.EOF cbUserName.AddItem rsmc.Fields("用户名") rsmc.MoveNext Wend cbUserName.SetFocus tbPwd.Text = "" cbUserName.Refresh End Sub Private Sub Form_Unload(Cancel As Integer) conn.Close Set rs = Nothing End Sub Sub login() Dim strSql As String userName = "" If Trim(cbUserName.Text) = "" Then MsgBox "用户名不用为空,请选择用户名!", vbOKOnly + vbExclamation, "警告" cbUserName.SetFocus Else strSql = "select * from 用户信息表 where 用户名='" & Trim(cbUserName.Text) & "'" Set rs = New ADODB.Recordset rs.Open strSql, conn, 2, 2 If Trim(rs.Fields("密码")) = Trim(tbPwd.Text) Then rs.Close Me.Hide userName = Trim(cbUserName.Text) 'Load frmMain frmMain.Show Exit Sub Else MsgBox "密码不对,请重新输入!", vbOKOnly + vbExclamation, "警告" tbPwd.Text = "" tbPwd.SetFocus End If loginTimes = loginTimes + 1 If loginTimes = 3 Then MsgBox "密码错误已有3次,你不能进入系统!", vbOKOnly + vbQuestion, "提示" Unload Me End If End If End Sub 3、主模块 Private rs As ADODB.Recordset Dim stuNum As Integer Private Sub Form_Activate() Call conDB End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) conn.Close Set conn = Nothing End Sub Private Sub mnuAddPic_Click() frmAddPic.Show End Sub Private Sub mnuDeletePic_Click() frmDeletePic.Show End Sub Private Sub mnuShowpic_Click() frmShow.Show End Sub Private Sub mnuExit_Click() Unload Me End End Sub Private Sub mnuSMPic_Click() frmSMPic.Show End Sub Private Sub mnuUser_Click() Dim frm1 As New frmUser frm1.Show End Sub 4、显示图片模块 Dim str As String Dim rs As ADODB.Recordset Dim rsNum As Integer Dim nextNum As Integer Private Sub cbPic_Click() str = App.Path + "\" Set rs = New ADODB.Recordset Dim strConn As String strConn = "select * from pic where name='" + Trim(cbPic.Text) + "'" rs.Open strConn, conn, 0, 1 str = str + rs.Fields("address").Value 'MsgBox str Image1.Picture = LoadPicture(str) rs.Close End Sub Private Sub CmdNext_Click() nextNum = nextNum + 1 'MsgBox nextNum If nextNum > rsNum - 1 Then nextNum = 0 'MsgBox nextNum End If Dim temp As Integer temp = nextNum Set rs = New ADODB.Recordset rs.Open "pic", conn, 0, 1 ' rs.MoveFirst ' While Not rs.EOF And temp > 0 ' 'rs.MoveNext ' 'temp = temp - 1' ' Wend rs.Move (temp) str = App.Path + "\" str = str + rs.Fields("address").Value cbPic.Text = rs.Fields("name").Value Image1.Picture = LoadPicture(str) rs.Close End Sub Private Sub Form_Load() Call conDB str = App.Path + "\" nextNum = 0 Set rs = New ADODB.Recordset rs.Open "pic", conn, 0, 1 str = str + rs.Fields("address").Value Image1.Picture = LoadPicture(str) cbPic.Clear rsNum = 0 'MsgBox rsNum rs.MoveFirst While Not rs.EOF cbPic.AddItem rs.Fields("name") rsNum = rsNum + 1 rs.MoveNext Wend cbPic.Text = "tu1" rs.Close End Sub ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: VB电子相册
 输入关键字,在本站1000多万海量源码库中尽情搜索: