Groups | Blog | Home
all groups > dotnet ado.net > february 2008 >

dotnet ado.net : OracleDataReader Returns No Records With Nested SQL



b.pruitt@mindspring.com
2/26/2008 7:34:07 AM
Hello All,

Can anyone tell why one sql statement works with the data reader but
not the other. To test, I uncomment the string I need.

Dim QueryString As String

***This string does not work
'QueryString = "SELECT * FROM print_server WHERE LS = (SELECT LS FROM
vw_turboinfo WHERE tsn = '080226086')"

***This string does work, and the result returned does exist in
print_server
'QueryString = "SELECT LS FROM vw_turboinfo WHERE tsn = '080226086'"

***This string does work
'QueryString = "SELECT * FROM print_server WHERE LS = 4042390"

Dim Command As New OracleCommand(QueryString, oraCon)
Command.CommandType = CommandType.Text

***I have copied the CommandText into TOAD for Oracle for each of the
3
***strings, and each is valid and returns the correct information.
Debug.Print(Command.CommandText)

Dim reader As OracleDataReader

Try
reader = Command.ExecuteReader
While reader.Read
Debug.Print(reader.Item(1)).ToString
End While
Catch ex As Exception
MsgBox(ex.Message)
Finally
LineSupport@gmail.com
2/26/2008 7:59:47 AM
[quoted text, click to view]

Ok, how silly of me. The print_server table I was accessing was a new
table. I had just created it using TOAD and populated it with data.
But I had not commited the change yet. In TAOD, the sql worked fine
AddThis Social Bookmark Button