3
在.NET中SqlDataReader的可檢索多個記錄集:PHP中有多個結果集?
Dim Connection As New SqlConnection(SomeConnectionString)
'Note that the command will generate three result
Dim Command As New SqlCommand("select '1a', '1b'; " & _
"select '2a', '2b', '2c'; " & _
"select '3a', '3b'; ", Connection)
Dim Reader As SqlDataReader
Connection.Open()
Reader = Command.ExecuteReader
Do
While Reader.Read
'Do something with the data
End While
Loop While (Reader.NextResult) 'Proceed to next result
Reader.Close()
Connection.Close()
的.NextResult
移動閱讀器到下一個結果。如何在PHP中做到這一點?我基本上想要避免多次往返數據庫。
注意:.Read
此處移動下一行,而.NextResult
移動到下一個結果。
1查詢,3分的結果:
結果1個
1a 1b
結果2
2a 2b 2c
結果3
3a 3b
注:行不等於導致。結果更像是一個表或一組行。
我認爲就是這樣。 MySQL或MSSQL?你怎麼看? – dpp
我不認爲MySQL(或者至少PDO mysql驅動程序)支持多個結果集。 PostgreSQL可能會,而且我也沒有任何關於PDO的SQL Server驅動程序的第一手經驗,所以我不能對此發表評論。 – cdhowie
Noooooooo !!我只會對此做一些研究。 Thanks1 – dpp