M
moondaddy
I'm trying to filter a table using the select method like this:
Note: dsSessionMngr is a strongly typed dataset
CustRef is a string column in the dataset's table named CartDetails
Dim tb As dsSessionMngr.CartDetailsDataTable = Me.dsSM.Tables("CartDetails")
Dim crit as string = "1234 - Blue" '1234 is not a number but is just part
of a alphanumeric value
Dim foundRows() As dsSessionMngr.CartDetailsRow = tb.Select("CustRef = " &
crit )
When this 3rd line executes I get an exception saying:
Cannot find column [Blue].
It thinks I'm taking a numeric value of 1234 and subtracting the value in a
column called 'Blue'. So I tried wrapping the criteria in single quotes and
double quotes similar to what you might do in sql server for a varchar
parameter variable. the double quote bombed with some sort of syntax error,
but single quote gave me an exception saying:
You can not use "=" when comparing datatypes string and int32.
This is because the value in the dataset was a string value of "1234" and
the criteria was " '1234 - Blue' ".
ADO is trying to be too smart and figure things out for itself. The column
is a string data type and I'm comparing it with a string value for the
criteria which is what I'm supposed to do.
How can I get this to work?
Thanks.
Note: dsSessionMngr is a strongly typed dataset
CustRef is a string column in the dataset's table named CartDetails
Dim tb As dsSessionMngr.CartDetailsDataTable = Me.dsSM.Tables("CartDetails")
Dim crit as string = "1234 - Blue" '1234 is not a number but is just part
of a alphanumeric value
Dim foundRows() As dsSessionMngr.CartDetailsRow = tb.Select("CustRef = " &
crit )
When this 3rd line executes I get an exception saying:
Cannot find column [Blue].
It thinks I'm taking a numeric value of 1234 and subtracting the value in a
column called 'Blue'. So I tried wrapping the criteria in single quotes and
double quotes similar to what you might do in sql server for a varchar
parameter variable. the double quote bombed with some sort of syntax error,
but single quote gave me an exception saying:
You can not use "=" when comparing datatypes string and int32.
This is because the value in the dataset was a string value of "1234" and
the criteria was " '1234 - Blue' ".
ADO is trying to be too smart and figure things out for itself. The column
is a string data type and I'm comparing it with a string value for the
criteria which is what I'm supposed to do.
How can I get this to work?
Thanks.