Click here to Skip to main content
15,912,069 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a datatable that contains only a single field "cl_mt" and another datatable that contains 3 fields "cl_id","cl_description","cl_mt" i'm trying to write the following code:
VB
Dim dt() As DataRow
    dt = serviceTable.Select("cl_id,cl_description where cl_mt='" & CInt(mt_combo.SelectedValue) & "'")(0).Item("cl_cl_id")


i need to get all the cl_id and the cl_description from my datatable where the cl_mt is equal to a certain value in the other datatable

the code i'm writing is giving me index error and syntax error

note that both datatables are being filled a comboboxes

any idea how can i improve my query?
Posted
Comments
CHill60 12-Sep-13 7:44am    
What is the syntax error you are getting?
Bernhard Hiller 12-Sep-13 8:16am    
I find it strange that you use CInt on one hand, while on the other hand you use ''. What about:
...where cl_mt=" & CInt(mt_combo.SelectedValue))(0).Item...?

1 solution

Hi Joce; try this;

VB
Dim dt() As DataRow
    dt = serviceTable.Select("cl_mt=" & CInt(mt_combo.SelectedValue) & "")(0).Item("cl_cl_id")


and also refer this link;

http://www.akadia.com/services/dotnet_filter_sort.html[^]

I hope this will help you.

Thank's
Mohan G
 
Share this answer
 

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