Solved

using ntext fields in filter criteria

Posted on 2004-03-21
4
324 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This article explains all about SQL Server Piecemeal Restore with examples in step by step manner.
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…

808 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