CREATE PROCEDURE AddRecord @myNewKey INT OUTPUT AS INSERT INTO testTable1(myText) VALUES('tests') SELECT @myNewKey = @@IDENTITY GOOutput when called in Query Analyzer is correct, using the T-SQL statements (a one-field, one row output)
DECLARE @i INT EXECUTE AddRecord @i OUTPUT SELECT @i As MyKey - - - - - - output - - - - - - MyKey 30VB6 code
Dim mySQL As String Dim rsFetch As ADODB.Recordset mySQL = "DECLARE @i INT" & vbCrLf _ & "EXECUTE AddRecord @i OUTPUT" & vbCrLf _ & "SELECT @i As MyKey" Set rsFetch = New ADODB.Recordset With rsFetch .Open mySQL, dbMain Text1.Text = !MyKey .Close End WithThe above VB code gnerates the error
"Item cannot be found in the collection corresponding to the requested name or ordinal."on the line
Text1.Text = !MyKey