Undefined function TO_DATE, TO_NUMBER

  • Thread starter Thread starter Rex Cho via .NET 247
  • Start date Start date
R

Rex Cho via .NET 247

Though I used oleDB, and your select statement:
Imports System.Data.oledb
Dim con As OleDbConnection
Dim cmd1 As OleDbCommand
Dim totalStr As String = "SELECT(TO_NUMBER(to_date('18-AUG-2002')-to_date('14-AUG-2002'))) as Age FROM Calls"

con = New OleDbConnection(conStr)
con.Open()
cmd1 = New OleDbCommand(totalStr, con)
totalReportGrid.DataSource = cmd1.ExecuteReader()
totalReportGrid.DataBind()
con.Close()

I got an error msg like this;
Undefined function 'TO_NUMBER' in expression.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Undefined function 'TO_NUMBER' in expression.

How can I make it work?
 
Rex Cho via .NET 247 said:
Though I used oleDB, and your select statement:
Imports System.Data.oledb
Dim con As OleDbConnection
Dim cmd1 As OleDbCommand
Dim totalStr As String =
"SELECT(TO_NUMBER(to_date('18-AUG-2002')-to_date('14-AUG-2002'))) as Age
FROM Calls"

con = New OleDbConnection(conStr)
con.Open()
cmd1 = New OleDbCommand(totalStr, con)
totalReportGrid.DataSource = cmd1.ExecuteReader()
totalReportGrid.DataBind()
con.Close()

I got an error msg like this;
Undefined function 'TO_NUMBER' in expression.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Undefined function
'TO_NUMBER' in expression.

How can I make it work?

As the error message refers to interpretation of the select string, you'll
need to tell us what DBMS you're sending the SELECT query to. Whatever that
DBMS is, it cannot deal with "TO_NUMBER".
 
Back
Top