Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Search Criteria

Author  Topic 

saidev
Posting Yak Master

101 Posts

Posted - 2006-08-22 : 13:09:18
Hi Guys,

I have two drop down boxes and one text box. Text box is the value to search.


1st drop down is the value i select and second drop down is " =, <, >, > =, < = ".

if i select " =" then i am getting the right value but if i select " < " then it is picking up only " > " .Here is my code. can you guys
help me what i am doing wrong..



Dim sql As String
Dim sqlwhere As String = ""

sql = "select * from tblMovies WHERE "
If Me.cboField1.SelectedValue <> "" And Me.txtValue1.Text <> "" Then

If Me.cboField1.SelectedValue = Me.txtValue1.Text Then

sqlwhere = Me.cboField1.SelectedValue & " = '" & Me.txtValue1.Text & "'"
End If

If Me.cboField1.SelectedValue < Me.txtValue1.Text Then
sqlwhere = Me.cboField1.SelectedValue & " < '" & Me.txtValue1.Text & "'"
End If

If Me.cboField1.SelectedValue > Me.txtValue1.Text Then
sqlwhere = Me.cboField1.SelectedValue & " > '" & Me.txtValue1.Text & "'"
End If

Thanks

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2006-08-22 : 16:10:19
I have no clue what you are trying to do, but remember that you are comparing text and that "1000" is less than "50" when you compare strings. If you want to compare numeric values, you need to convert the strings first.

- Jeff
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-08-23 : 01:08:34
duplicate post [url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=70852[/url].

Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -