tonumber()

  • Thread starter Thread starter smoke
  • Start date Start date
S

smoke

In C# with an access table: (oledbadapter)

Table.Select(selectCommand);

Is there a way to return a result from a String Field that is numeric?

In other words a function like: tonumber()

I have a field that is text but that on occasion want to treat it as number.
I want to do a search such as: tonumber(text) > 10
 
Please have a look at the Convert class. It contains many static methods
(methods you can call without having to create an instance object of the
class first) which can convert to and from many formats. You could for
instance convert a string into an int, by using the following

int v = Convert.ToInt32("10");

So you could take your string field and run it through the correct method
and convert it to a numeric value (there are support for double etc as
well).

Hope this helps,

//Andreas Håkansson
 
Thanks but thats not what I asked.
I wanted to know how to have a select statement return
a numeric column from a string column using a table.select().
 
You should look into the T-SQL command CONVERT and CAST
which will enable you to change one datatype to another in your own
SQL statements.

Hope this helps,

//Andreas
 
Back
Top