vb.net - ORA-01858: 在需要数字的地方发现了一个非数字字符 - VB.NET
问题描述
我正在尝试构建一个用于查询 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
构建查询并尝试执行后,我得到 ORA-01858 错误。
解决方案
推荐阅读
- ios - ViewControllers 之间的转换没有为正确的 VC 设置动画
- python - 在 CustomVision.ai API 中发布数据时出错
- javascript - 初学者问题 - 提示、变量和范围
- swift - iOS14中表格部分标题中的白色背景
- python-3.x - python opencv试图用矩方法找到轮廓中心
- c++ - long long int 不支持大数的乘法
- sql - 查询1500万行,用node js处理
- python - AWS EKS 中使用 KubernetesExecutor 的 Apache Airflow 没有日志
- wso2 - 在 WSO2 EI 客户端信任库中续订证书
- python - Python - 父方法不访问变量子项的值