本文介绍了根据一系列值(例如2000-3000)选择SQL数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

sqlCmd = New SqlCommand(从表中选择*,其中(client_location ="& dd_State.SelectedItem.Text&"和client_pr_typ ="& amp; dd_Type.SelectedItem.文本&''和ClientPrice =''"& amp; dd_Type.SelectedItem.Text& amp;''),con)


此代码不适用于ClientPrice
所以客户价格应该是ans,以便它能像这些类型值一样识别2000-30000
40000-500000
500000-600000
etc

sqlCmd = New SqlCommand("select * from table where (client_location=''" & dd_State.SelectedItem.Text & "'' and client_pr_typ=''" & dd_Type.SelectedItem.Text & "'' and ClientPrice=''" & dd_Type.SelectedItem.Text & "'') ,con)


this code dosen''t work for ClientPrice
so what should be ans for Client price so that it recognise like these type value 2000-30000
40000-500000
500000-600000
etc

推荐答案


写道:​​

500000-600000

500000-600000



在-"上分割文本,然后重写查询以在这两个值之间进行选择(例如,myField> 50000和myField< 60000).



Split your text on the "-" and rewrite your query to select between these two values ( e.g. myField > 50000 and myField < 60000).


这篇关于根据一系列值(例如2000-3000)选择SQL数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 06:26