我在ComboBox
中有一个DataGridView
AccountDescription是数据网格视图(单元格2)中组合框列的列名
尝试从数据网格视图的组合框列中的数据库表中获取数据。
将cmd设置为新的OracleCommand(“ Select SNO,HEAD_NAME,JV_ACC_NAME,DEBIT,CREDIT来自VOUCHER_DETAIL,其中 VOUCHERNO =:Vno和VOUCHER_TYPE ='sno的'BAV'顺序”,sgcnn) cmd.Parameters.Add(“ @ Vno”,OracleDbType.NVarchar2).Value = txtJVNo.Text.ToString.Trim
Dim dtVD As New DataTable() Dim daVD As New OracleDataAdapter dtVD.Clear() daVD = New OracleDataAdapter(cmd) daVD.Fill(dtVD) dgvAccDetail.AutoGenerateColumns = False '-------- dgvAccDetail.DataSource = dtVD '--------------- If dtVD.Rows.Count > 0 Then For i As Integer = 0 To dtVD.Rows.Count - 1 dgvAccDetail.Rows(i).Cells(0).Value = dtVD.Rows(i).Item("SNO").ToString.Trim dgvAccDetail.Rows(i).Cells(2).Value = dtVD.Rows(i).Item("JV_ACC_NAME") dgvAccDetail.Rows(i).Cells(3).Value = dtVD.Rows(i).Item("DEBIT") dgvAccDetail.Rows(i).Cells(4).Value = dtVD.Rows(i).Item("CREDIT") Next End If
信息“组合框单元格值无效”
我只需要这样放
AccountDescription.ValueMember =“ HEAD_NAME” AccountDescription.DisplayMember =“ NAME_DESC”
请任何人告诉我我该怎么做,尝试了很多事情,但是没有用....