run-time error when coding with ldap api
I am new to vc and trying to connect a ldap server by VC6.
I found a code example from msdn ,here's the code's link:
http://msdn.microsoft.com/library/en-us/netdir/ldap/example_-_establishing_a_session_without_encryption.asp
While I think there's a litter error in this code (the variable "iRtn "has been defined twice) and I correct it, then compile this code. Until now everything goes smoothly. But When I choose run the code, a run-time message box appears and tell the fatal error, I have to abort the running.
I debug the code finding that the following line in the code brings the run-time error:
iRtn = ldap_set_option(pLdapConnection,
LDAP_OPT_PROTOCOL_VERSION,
(void*)&version);
I tried in some other machines. Most of them has the same situation -- run-time error,only one machine could run the code successfully without a single error. The difference between the "only one machine" and the others is that it has updated SDK and installed Visual Studio 6 Service Pace 5. Then I updated SDK and installed Visual Studio 6 Service Pace 5 also, however the run-time error are still. I don't kown what's wrong with my code? Could anyone give me some advice?thanks

