标题:求 vb.net2010+access 操作
只看楼主
linanfang721
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2014-4-22
 问题点数:0 回复次数:0 
求 vb.net2010+access 操作
定义了一个函数
程序代码:
    Sub ShowEmpInfo()
        Me.hr_nanme.Text = CurEmp.Emp_Name
        Me.hr_sex.Text = CurEmp.Sex
        Me.hr_num.Text = CurEmp.Emp_Num
        Me.hr_address.Text = CurEmp.Emp_Add
        Me.hr_intime.Text = CurEmp.Emp_intime
        Me.hr_outtime.Text = CurEmp.Emp_outtime
        Me.hr_memo.Text = CurEmp.Emp_Memo
    End sub

 


窗体有个listbox,需要加载 员工表 中的 员工姓名    Private Sub Frm_hr_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
   LBUserName.Items.Clear()
        Dim SQLString As String = "SELECT * FROM 员工表"
        Dim MSG As String = ""
        '执行SQL查询语句
        Dim DTable As DataTable = DBoperation.DBoperate(SQLString, MSG)
        Dim UserRow As DataRow
        For Each UserRow In DTable.Rows
            LBUserName.Items.Add(UserRow("员工姓名"))
            LBUserName.ValueMember = "员工ID"
            LBUserName.SelectedValue = "员工ID"
            'LBUserName.DisplayMember = "员工姓名"
        Next
    End Sub


选择员工姓名时,窗体其他标签的内容读取Access表的信息显示
程序代码:
    Private Sub LBUserName_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LBUserName.SelectedIndexChanged
        If LBUserName.ValueMember = "" Then
            CurEmp.Init()
        End If
        CurEmp.GetInfo(CInt(LBUserName.SelectedValue))
        ShowEmpInfo()
    End Sub

但是怎么也实现不了,就是这个selectedValue传递有问题





[ 本帖最后由 linanfang721 于 2014-4-22 22:01 编辑 ]
搜索更多相关主题的帖子: access 
2014-04-22 11:34



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-430460-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.106704 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved