這段時間用了一下c++ builder ,在調用存儲過程的時候遇到了一些問題,問了很多地方都沒有找到答案,最后還是靠自己,現在拿出來和大家分享。
示例代碼:
storedproc1->params->clear();
storedproc1->params->createparam( ftsmallint, "@m1", ptinput);
storedproc1->params->createparam( ftstring, "@m2", ptoutput);
storedproc1->params->createparam( ftinteger, "@m3", ptoutput);
storedproc1->params->createparam( ftinteger, "@m4", ptoutput);
storedproc1->params->createparam( ftinteger, "@m5", ptoutput);
storedproc1->params->createparam( ftinteger, "result", ptresult);
storedproc1->prepare();
storedproc1->execproc();
問題:調用存儲過程的時候總是報錯,注意,時在執行storedproc1->execproc()的時候就會報錯,其它的地方報的錯誤的解決方法不再本篇文章中。執行代碼報錯時的錯誤信息提示:錯誤:indicator variable required but not supplied
原因:當在執行的存儲過程的時候,如果有一項出項空值的時候,就會發生這樣的問題
解決:在存儲過程中對產成的空值進行處理,就可以了