查询数据表时出错 [英] error querying the datatable

查看:88
本文介绍了查询数据表时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的数据表只包含一个字段cl_mt,另一个数据表包含3个字段cl_id,cl_description,cl_mt我正在尝试编写以下代码:

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:

Dim dt() As DataRow
    dt = serviceTable.Select("cl_id,cl_description where cl_mt='" & CInt(mt_combo.SelectedValue) & "'")(0).Item("cl_cl_id")





i需要从我的数据表中获取所有cl_id和cl_description cl_mt等于另一个数据表中的某个值



我写的代码给我索引错误和语法错误

< b r />
请注意两个数据表都被填充组合框



任何想法如何改进我的查询?



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?

推荐答案

嗨Joce;试试这个;



Hi Joce; try this;

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





并且还可以参考这个链接;



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



我希望这会对你有所帮助。



谢谢

Mohan G



and also refer this link;

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

I hope this will help you.

Thank's
Mohan G


这篇关于查询数据表时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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