So, you've pasted here some code from MSDN[^]. If you're trying that sample mentioned in MSDN, do you have a replica of that database on your DB server? How many iterations does the loop run, and what is the value that the call returns each time? And if it's that integer value you mentioned earlier, have you tried looking up the header files to see which valid return type is defined as that number? Please try this, and tell me what you find. And in case you just pasted some random code from MSDN here in the hope that I'll setup a database here and do all the work to figure out what things could go wrong, ... I really don't have to be doing this at 3AM, you know?
"Real men drive manual transmission" - Rajesh.