Click here to Skip to main content
15,882,941 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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()
Posted
Updated 27-Sep-17 5:25am

1 solution

 
Share this answer
 
Comments
Member 13369800 28-Sep-17 10:49am    
it didn't work
this gives me only the ID of the first element of the DDL
OriginalGriff 28-Sep-17 10:55am    
If that's the selected item, then yes, it will. That's what it's supposed to do...
Member 13369800 29-Sep-17 10:22am    
I think the problem is from the sql statement
how should I take only the first name from DDL(since it contains first and last name concatenated with a space) to compare it in table person to get its ID
anyway thanks for your help

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900