現在可以執行這個存儲過程了 m_precordset = m_pcommand->execute(0,0,adcmdstoredproc); 這個時候,如果接下來用 _variant_t ret_val = m_pcommand->parameters->getitem((long)0)->value; 那么將得不到值 而如果像下面這樣調用的話就可以得到返回值了 m_precordset->close(); _variant_t output_para = m_pcommand->parameters->getitem((long)0)->value; ms ado.net給這一現象的回復是: you can think of a stored procedure as a function in your code. the function doesn’t return a value until it has executed all of its code. if the stored procedure returns results and you haven’t finished processing these results, the stored procedure hasn’t really finished executing. until you’ve closed the datareader, the return and output parameters of your command won’t contain the values returned by your stored procedure. 也就是說execute()函數應該看成是直到m_precordset關掉以后才會正確返回.