Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
rdugre
Starting Member
32 Posts |
Posted - 2001-01-10 : 17:53:00
|
| I am trying to run the following stored procedure from an Active Server Page. Here it is:----------------CREATE PROCEDURE sp_TPRandomQuestions (@testid varchar(12)) ASSET NOCOUNT ONCREATE TABLE #quesorder (lngQID int NOT NULL, dblRand float NULL) INSERT #quesorder (lngQID) SELECT lngQID FROM tblTPQuestions WHERE (txtTestID=@testid) ORDER BY lngNumberDECLARE Randomizer CURSOR FOR SELECT dblRand FROM #quesorderOPEN RandomizerFETCH NEXT FROM RandomizerWHILE @@Fetch_Status != -1BEGIN UPDATE #quesorder SET dblRand = rand() WHERE CURRENT OF Randomizer FETCH NEXT FROM RandomizerENDCLOSE RandomizerDEALLOCATE RandomizerSELECT tblTPQuestions.lngQID AS QID, tblTPQuestions.txtQuestionFROM tblTPQuestionsINNER JOIN #quesorder ON tblTPQuestions.lngQID = #quesorder.lngQIDORDER BY #quesorder.dblRandRETURN----------------The problem is, when I run the stored procedure within my Active Server Page and then try to reference the QID field in the last SELECT statement, it bombs with the following error:Error Type:ADODB.Recordset (0x800A0CC1)Item cannot be found in the collection corresponding to the requested name or ordinal./tc/rand/TestEng2.asp, line 79The error is referring to my reference of the QID field on this line:lngQID = CLng(myRs("QID"))Now, I know that data exists in my database for this query, but I am not certain that the query above is written correctly. This query is attempting to randomize a set of questions for a test.Please help! |
|
|
|
|
|