Hi all,
I'm no DB expert and this is my first time working with Oracle so bear with me. I have two DateTimePickers (sellOffStart and sellOffEnd) which I use their values when querying the database. So, I'm doing this:
vb.net Code:
Dim sql As String = _ "select " & _ "cus.FIELD_VALUE as ""Sell Off Date"", " & _ "ag.AGREEMENTS_ABBR as ""Licensor Number"", " & _ "ag.AGREEMENTS_NAME as ""Project"" " & _ "from V_REPCUSTOMFIELDDATA cus " & _ "right join V_AGREEMENT ag " & _ "on cus.ASSOCIATED_WITH_INTERNAL_KEY = ag.CONTRACT_CODE " & _ "where " & _ "cus.INTERNAL_DESCRIPTIONS_CODE = 35 " & _ "and ag.AGREEMENTS_ABBR LIKE :licensorNum " & _ "and cus.FIELD_VALUE between " & _ "to_date(:sellOffStart, 'MM/DD/YY HH12:MI:SS AM') and to_date(:sellOffEnd, 'MM/DD/YY HH12:MI:SS AM') " & _ "order by " & _ """Sell Off Date"", " & _ """Licensor Number""" Dim cmd As New OracleCommand(sql, conn) cmd.Parameters.AddWithValue("licensorNum", "%" & Me.sellOffLicensorNum.Text & "%") cmd.Parameters.AddWithValue("sellOffStart", Me.sellOffStart.Value.ToString()) cmd.Parameters.AddWithValue("sellOffEnd", Me.sellOffEnd.Value.ToString())
Am I supposed to ToString() the DateTimePicker.value and then use Oracle's TO_DATE() to turn that string right back into Oracle's DATE? Is this how I am supposed to do this?
It works, but I'm just curious if this is the "correct" way.
Thanks for helping this DB rookie.![]()




Reply With Quote