I had a parameterized query with some string variables binding to the OracleParameters. The query works with certain parameters but doesn’t with others. Take a simplified database table with only 2 columns for example:
My original query looks something like this. The first query works. The second runs normally without error message but returns no result when there are records matched in the database.
Dim currency As string = "USD" Dim serialNo As string = "1311B" 'Quering with cmd1 works Dim cmd1 As New OracleCommand("SELECT * FROM SampleTable WHERE Currency = :Currency") cmd1.Parameters.Add(New OracleParameter("Currency", currency)) 'Quering with cmd2 works but no record is returned when there are matching records in the database Dim cmd2 As New OracleCommand("SELECT * FROM SampleTable WHERE SerialNo = :SerialNo") cmd2.Parameters.Add(New OracleParameter("SerialNo", serialNo))