Solved

using ntext fields in filter criteria

Posted on 2004-03-21
4
342 Views
Last Modified: 2008-01-09
I use VB6 and Sql server, when i used this code :-

rscabasho.Filter = "(jawaab is null and kusocota ='" & st & "')  or (katimi='" & st & "' and jawaab<>'') "

Jawaab is ntext field, if i use any other field works well, as well if i use the field jawaab with = operator it works , but this can't be used , since  it could be a NULL value.


Then I encountered this message:-
3001/ argoments are of the wrog type, are out of the acceptable range , or are inconflict with one another

pls i need your suggestions.
Thanks.

M. roble
0
Comment
Question by:rooble
4 Comments
 
LVL 7

Expert Comment

by:mquiroz
ID: 10644726
maybe something like this:

rscabasho.Filter = "(jawaab is null and kusocota ='" & st & "')  or (katimi='" & st & "' and jawaab<>'') or  (katimi='" & st & "' and jawaab is not null)  "
0
 
LVL 13

Accepted Solution

by:
danblake earned 125 total points
ID: 10648392
You cannot perform a = '' or <> for ntext fields.

You would need to patern search for values using:
PATINDEX
Returns the starting position of the first occurrence of a pattern in a specified expression, or zeros if the pattern is not found, on all valid text and character data types.

Syntax
PATINDEX ( '%pattern%' , expression )

or alternativly the charindex string search :
The CHARINDEX and PATINDEX functions return the starting position of a pattern you specify. PATINDEX can use wildcard characters while CHARINDEX cannot.

From BOL.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Creating and Managing Databases with phpMyAdmin in cPanel.
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question