Sebenarnya masalah query udah menemukan solusi, yaitu dengan menggunakan stored procedure yang memuat variable table.
Kemudian masalah muncul ketika memasukan stored procedure tersebut ke recordset. Data recordset kosong, koq bisa? Gimana iniiii.....???
Searching punya searching ternyata solusi nya mudah sekali hehehehe...
Cukup menambahkan
set nocount on
diawal stored procedureContohnya seperti ini:
CREATE PROCEDURE dbo.spGetCheckTime
@ID INT
AS
SET NOCOUNT ON --> here it is
DECLARE @MyTable AS TABLE (
[BeginTime] DATETIME,
[EndTime] DATETIME,
[Retrieved] DATETIME
)
INSERT @MyTable([BeginTime], [EndTime], [Retrieved])
SELECT n.[BeginTime], n.[EndTime], getdate() FROM dbo.tblCheck n
WHERE n.IDCheck = @ID ORDER BY n.BeginTime
SELECT * FROM @MyTable
and done!!!
Sumber:
http://www.dbforums.com/microsoft-sql-server/973595-when-selecting-table-variable-vb6-sproc-recordset-doesnt-open.html
0 Comments