我正在尝试构建一个用于查询Oracle数据库的SQL语句,并将两个参数作为日期类型。
cmd.Parameters.Add(New OracleParameter(":pCommencementDate", OracleDbType.Date)).Value = comm.OraFormatDate(txtCommenceDate.Text)
cmd.Parameters.Add(New OracleParameter(":pCompletionDate", OracleDbType.Date)).Value = comm.OraFormatDate(txtCompleteDate.Text)
Public Function OraFormatDate(ByVal strDate As String) As String
Try
Dim a As Date
SetGlobalDay()
a = Format(CDate(strDate), "dd/MM/yyyy")
Return "to_date('" & a & "','dd/mm/yyyy')"
Catch ex As Exception
ERR.sWriteErrorLog("C:\", "(common OraFormatDate) -> " & ex.Message)
End Try
End Function
构建查询后,尝试执行i得到ORA-01858错误。