0

我正在从我的 vb.net 应用程序调用以下查询到 oracle 服务器,并且在我的 oracle sql 开发人员上执行了相同的查询并正确给出了结果。但是当从下面的 vb.net 代码调用相同的查询时,结果在数据表中出现零行,没有任何异常。

提前致谢。

甲骨文

with sdk as (select roll_no from student where roll_no='1001';)
select * from sdk;

VB

Dim MyconnectionString As String = "provider=MSDAORA.1;data source=student;user id=ss;password=1234;
Dim myOleDbConnection As New OleDbConnection(MyconnectionString)

Dim loDataTable As New DataTable
Dim loCommand As New OleDbCommand
Dim loDataAdapter As New OleDbDataAdapter

loCommand.CommandText = "with sdk as (select roll_no from student where roll_no='1001')select * from sdk;"                
loCommand.CommandType = CommandType.Text
loCommand.Connection = myOleDbConnection
loCommand.CommandTimeout = 0
loDataAdapter.SelectCommand = loCommand
loDataAdapter.Fill(loDataTable)
4

1 回答 1

0

您有两个不同的查询:

with sdk as (select roll_no from student where roll_no='1001';)

对比

with sdk as (select roll_no from student where roll_no='1005')

所以我猜你有 roll_no = 1001 的数据,但没有 roll_no = 1005 的数据

于 2013-04-18T10:32:32.507 回答