vb.net将数据集值填充为组合框值成员问题

时间:2016-07-26 14:43:50

标签: sql vb.net oracle combobox

        myORAConnection.Open()

        Dim SQLString As String = "Select child_id as id, child_name as name from xxi_org_structure_v Where parent_id=" & LegalEntity & ""
        Dim cmd As New OracleCommand(SQLString, myORAConnection, OraTrans)
        Dim daTableORA As New OracleDataAdapter(cmd)
        daTableORA.Fill(dtOrg)

        daTableORA.Dispose()
        cmd.Dispose()
        myORAConnection.Close()

        With IT_ORG_CODEComboBox
            .DataSource = dtOrg.Tables(0)
            .ValueMember = "id"
            .DisplayMember = "name"
        End With

    Catch ex As Exception
        MsgBox(ex.Message)
    End Try

    'TODO: This line of code loads data into the 'Main_POSDataSet.pos_promotion_item_group_details' table. You can move, or remove it, as needed.
    Me.Pos_promotion_item_group_detailsTableAdapter.Fill(Me.Main_POSDataSet.pos_promotion_item_group_details)

    'TODO: This line of code loads data into the 'Main_POSDataSet.pos_promotion_item_group_headers' table. You can move, or remove it, as needed.
    Me.Pos_promotion_item_group_headersTableAdapter.Fill(Me.Main_POSDataSet.pos_promotion_item_group_headers)

我使用oracle的值填充组合框,但是从sql获取所选值并将其存储到sql中。

我正在从#34; Main_POSDataSet.pos_promotion_item_group_headers"中获取填写表单的值,但是我想告诉表单或数据集或组合框从" IT_ORG_CODE&#中检索到的值34; column将用作组合框值成员而不是显示成员。

无论如何要解决这个问题吗?

enter image description here

237是用作组合框值成员的组织ID,但在这里它用作显示成员!!

1 个答案:

答案 0 :(得分:0)

只需替换

Me.IT_ORG_CODEComboBox.DataBindings.Add(New System.Windows.Forms.Binding("SelectedValue", Me.Pos_promotion_item_group_headersBindingSource, "IT_ORG_CODE", True))

使用

def print_batch
  batch = Batch.find(params[:id])
  respond_to do |format|
    format.pdf {
      html = render_to_string("_batch",:formats => [:html], layout: false , locals: { batch: batch })
      Rails.logger.debug(html.inspect)
      kit = PDFKit.new(html)
      send_data(kit.to_pdf, :filename => "file_name_#{batch.id}.pdf", :type => 'application/pdf') and return
    }
    format.html
    format.json { render json: {id: batch.id, processed: batch.processed?} }
  end     

end
表单设计器代码中的