如果我在同一命令中有两个或多个查询:
Using myCommand As New OracleCommand(
"select value from table where id between 1 and 3;" &
"select value1 from table where id = 1000", DBSettings.GetConnection())
我有DataTable
,从第一个请求中选择值
Dim dt As DataTable = New DataTable
dt.Load(myCommand.ExecuteReader)
value1 = dt.Rows(0).Item(0).ToString().Trim()
value2 = dt.Rows(1).Item(0).ToString().Trim()
value3 = dt.Rows(2).Item(0).ToString().Trim()
我可以从第二请求中获取值throuth datatable吗?我的值是否有可能从以下请求中获得行?
我不想创建很多命令和数据表,因为我有很多命令以及我需要初始化的值
进行联合。它将将两个查询组合为一个结果集。
select value from table where id between 1 and 3
UNION
select value1 from table where id = 1000;
以下是相同的查询,其中包含来自您的问题的新信息
SELECT SYSPARM_VAL2 FROM SMS_PARM WHERE SYSPARM_ID BETWEEN 9900029 AND 9900033
UNION
SELECT SYSPARM_VAL4 FROM SMS_PARM WHERE SYSPARM_ID = 9900030;