如何通过引用DDL获取id [英] How do I get the id by referring from a DDL

查看:105
本文介绍了如何通过引用DDL获取id的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一些帮助这个问题

我有2张桌子

人(prsID(PK),姓名,fname,DOB ....)

索赔人(prsCLMID(FK),工作......)

我有一个下拉列表,其中包含prsID,名称+''+ fname从表人中选择(仅限姓名+在DDL中填充''+ fname)

我需要从包含personID作为外键的表客户端获取所选DDL值的ID(我该如何检查表人员的姓名和得到他的身份证)



我尝试过的事情:



i尝试过



hi plz i need some help in this question
I have 2 tables
person ( prsID (PK) , name , fname , DOB .... )
claimant (prsCLMID (FK) , job ... )
I have a drop downn list containing prsID, name + ' ' + fname selected from table person (only name + ' ' + fname is populated) in DDL )
I need to get the ID for the selected value of DDL from table client that contains personID as foreign key (how should I check the name from table person and get his ID )

What I have tried:

i have tried

Dim dadptclaim As New SqlDataAdapter("SELECT prsid, fname + ' ' + name as na FROM person join claimant on prsID=prsCLMID WHERE (prsID =prsCLMID)", sql)

       dadptclaim.Fill(ds, "CLM")
       claimant.DataSource = ds.Tables("CLM")
       claimant.DataValueField = "prsid"
       claimant.DataTextField = "na"

       claimant.DataBind()

推荐答案

使用 ListControl.SelectedValue属性(System.Web.UI.WebControls) [应该返回ID的^


这篇关于如何通过引用DDL获取id的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆