我使用vb.net和oracle的基本日期選擇器作爲我的數據庫。當我插入從基本的日期選擇器的日期,我得到這個錯誤>> ORA-01797:此操作必須遵循的任何或所有爲什麼我的基本日期選取器無法將輸入轉換爲日期時間格式?
這是我的代碼:
Private Function GetDate(ByVal bdp1 As Date) As DataSet
Dim connectionString As String = "Data Source = ***; User ID =***; Password =**;"
Dim sqlConnection As OracleClient.OracleConnection = New OracleClient.OracleConnection(connectionString)
Dim queryString As String = "select * from smsdw.lot_act where tran_dttm <= ('" & bdp1 & "' , 'MM/DD/YYYY') and tran_dttm > ('" & bdp1 & "', 'MM/DD/YYYY')"
Dim sqlCommand As OracleClient.OracleCommand = New OracleClient.OracleCommand(queryString, sqlConnection)
sqlCommand.CommandTimeout = 0
Dim dataAdapter As OracleClient.OracleDataAdapter = New OracleClient.OracleDataAdapter(sqlCommand)
Dim dataSet As DataSet = New DataSet
dataAdapter.Fill(dataSet)
Return dataSet
End Function
注意SQL注入。 –