Connecting Tech Pros Worldwide Forums | Help | Site Map

Filter ADO Recordset Error

ufgator1978@yahoo.com
Guest
 
Posts: n/a
#1: Nov 21 '05
Hi All,

First off I'd like to mention that I know this should be done in
ADO.NET, but I have been asked to do it in regular ADO. =( Having said
that, here is the problem I am experiencing...

I'm working with VB.NET and I have a recordset and I am trying to set a
filter on it. I am getting an error that says "Arguments are of the
wrong type, are out of acceptable range, or are in conflict with one
another." Here is the code I am using:

Dim rs As ADODB.Recordset
rs = GetRecordset("SELECT * FROM Test", adUseClient, adLockReadOnly,
adOpenStatic, GetMainConn, True)
rs.Filter = "test"

I checked the filter immediately after I get the recordset and I notice
that the filter has a value of 0 {Integer}. I also verified that the
rs has the correct number of records. Can anyone help me with this
error???

Many thanks...


Armin Zingler
Guest
 
Posts: n/a
#2: Nov 21 '05

re: Filter ADO Recordset Error


<ufgator1978@yahoo.com> schrieb[color=blue]
> Hi All,
>
> First off I'd like to mention that I know this should be done in
> ADO.NET, but I have been asked to do it in regular ADO. =( Having
> said that, here is the problem I am experiencing...
>
> I'm working with VB.NET and I have a recordset and I am trying to
> set a filter on it. I am getting an error that says "Arguments are
> of the wrong type, are out of acceptable range, or are in conflict
> with one another." Here is the code I am using:
>
> Dim rs As ADODB.Recordset
> rs = GetRecordset("SELECT * FROM Test", adUseClient, adLockReadOnly,
> adOpenStatic, GetMainConn, True)
> rs.Filter = "test"[/color]

"test" what? Filter needs an expression, like "name = 'miller'".

http://msdn.microsoft.com/library/en...dprofilter.asp
[color=blue]
> I checked the filter immediately after I get the recordset and I
> notice that the filter has a value of 0 {Integer}. I also verified
> that the rs has the correct number of records. Can anyone help me
> with this error???
>
> Many thanks...[/color]


Armin

GatorBait
Guest
 
Posts: n/a
#3: Nov 21 '05

re: Filter ADO Recordset Error


Hi,

Thank you for your response. I know that the filter needs an
expression....I was trying to illustrate that it does not matter what
text I set the filter to. I am getting the error because the filter is
of type Integer and I am setting it equal to an expression (of any
value) of type String.

Do you know why this is not working???

Armin Zingler
Guest
 
Posts: n/a
#4: Nov 21 '05

re: Filter ADO Recordset Error


"GatorBait" <MPotok@gmail.com> schrieb[color=blue]
> Hi,
>
> Thank you for your response. I know that the filter needs an
> expression....I was trying to illustrate that it does not matter
> what text I set the filter to. I am getting the error because the
> filter is of type Integer and I am setting it equal to an expression
> (of any value) of type String.
>
> Do you know why this is not working???
>[/color]

I thought the value of the property is Integer, not the data type of the
property. The message you get, is it a runtime exception or a compiler
message? I guess the latter. I'm afraid, I won't have an answer anyway, but
you might turn to an ADO or Framework.Interop group as this question is not
related to the VB.Net language (what I am (hopefully) better in).


Armin

ufgator1978@yahoo.com
Guest
 
Posts: n/a
#5: Nov 21 '05

re: Filter ADO Recordset Error


ok, thanks for the effort

Closed Thread