Dim cmd As New ADODB.Command
Dim rs As ADODB.Recordset Cmd.ActiveConnection = "DSN=MySamples;UID=sa"
Cmd.CommandText = "MyNextProc"
Cmd.CommandType = adCmdStoredProcSet rs = Cmd.Execute()
While Not rs Is Nothing
If (Not rs.EOF) Then
Debug.Print rs(0)
End If
Set rs = rs.NextRecordset()
Wend
Dim rs As ADODB.Recordset Cmd.ActiveConnection = "DSN=MySamples;UID=sa"
Cmd.CommandText = "MyNextProc"
Cmd.CommandType = adCmdStoredProcSet rs = Cmd.Execute()
While Not rs Is Nothing
If (Not rs.EOF) Then
Debug.Print rs(0)
End If
Set rs = rs.NextRecordset()
Wend
比如在存储过程中有很多这样的语句:
Select InventoryID From Inventory Where Inventory = '888888'
Select InventoryID From Inventory Where Inventory = '888888'
Select InventoryID From Inventory Where Inventory = '888888'
.
.
.
Select InventoryID From Inventory Where Inventory = '888888'
当然是比喻,你把这个拿到查询分析器一远行,在结果集就有N多的表格了,是不是?
现在我想的是,我就要出现一个表格。也就是我最后一次查询的结果。谢谢
if ..
select ...
else
select ...
你要做的不是怎么去去除临时结果,而是需要优化你的sql语句,用视图,用各种技巧避开他,要不,即使你去除了临时结果,效率也会很低的。
你可以贴出存储过程来看看