acadia
acadia

Reputation: 2625

Oracle datetime in VB.net

I have a Oracle procedure to which I have to pass a datetime value (2/5/2010 11:46 AM) How do I pass this value from VB.net. When I pass the date as shown below it is not returning any records though there are records.

With Cmd
                .Connection = FactsConn
                .CommandType = CommandType.StoredProcedure
                .CommandText = "sp_atas_image_qry"
                .Parameters.Add(New OracleParameter("vinspectiondatetime", OracleClient.OracleType.DateTime)).Value = "2/5/2010 11:46 AM"
                .Parameters.Add(New OracleParameter("io_cursor", OracleClient.OracleType.Cursor)).Direction = ParameterDirection.Output
            End With

Upvotes: 0

Views: 2803

Answers (2)

SLaks
SLaks

Reputation: 887215

You're setting the parameter value to a string.

You need to set it to a DateTime value, like this: #2/5/2010 11:46 AM#

Upvotes: 1

Fredrik Mörk
Fredrik Mörk

Reputation: 158289

You should probably send a DateTime object, not a String:

.Parameters.Add(New OracleParameter("vinspectiondatetime", OracleClient.OracleType.DateTime)).Value = new DateTime(2010, 2, 5, 11, 46, 0)

Upvotes: 0

Related Questions