本文介绍了如何根据从下拉列表中选择的值将数据检索到文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨,,

如何将数据检索到文本框,具体取决于从sqlDb的下拉列表中选择的值...





我有用于填充下拉列表的托管代码,如下所示:



Public Sub fildp()



cmd.Connection = cn

cmd.CommandText =Select * From Acct_Sum

Dim da As New SqlDataAdapter(cmd)

Dim dt As New DataTable()

da.Fill(dt)

DPList.DataSource = dt

DPList.DataTextField =Bor_Name

DPList.DataValueField =Loan_code

DPList.DataBind()

DPList.Items.Insert(0,选择贷款代码 )



End Sub



现在,我在Form上有多个文本框。我想根据所选项目表格显示来自sqldb的数据下拉列表..



Plz帮助

Thnx

Hi,,
how to retrieve data to a textbox depending on the value selected from a dropdownlist from sqlDb...


I have Managed code for populating Dropdownlist as below:

Public Sub fildp()

cmd.Connection = cn
cmd.CommandText = "Select * From Acct_Sum"
Dim da As New SqlDataAdapter(cmd)
Dim dt As New DataTable()
da.Fill(dt)
DPList.DataSource = dt
DPList.DataTextField = "Bor_Name"
DPList.DataValueField = "Loan_code"
DPList.DataBind()
DPList.Items.Insert(0, "Select Loan code")

End Sub

Now, I have multiple textboxes on Form. I want to display data from sqldb based on selected item form Dropdownlist..

Plz help
Thnx

推荐答案

DPList_onselectedChanged()
{
textbox1.text = DPList.selecteditem.tostring();
}


这篇关于如何根据从下拉列表中选择的值将数据检索到文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 09:47