请教高手:  
     在VC使用db-library联接数据库,数据库发生联接错误时,出现:Operration  System  eror  0,然后内存猛涨,请问如何测试和避免这种情况?  

解决方案 »

  1.   

    系统错误。see this:DB-Library Architecture
    For the Win32-based versions of the DB-Library dynamic-link library (DLL), a separate operating-system thread may be spawned for each connection that DB-Library makes with SQL Server (depending on the Net-Library in use). Each instance of the DB-Library DLL loaded by a calling process gets a private data area, while sharing code.Win32-based DB-Library architecture differs from the implementation with the Windows operating system. In Windows, MSDBLIB3.DLL maintains DB-Library connections as a linked list of connections in a single data segment. This architecture is required because in the Windows operating system, dynamic-link libraries have a single data segment that is shared among all calling processes. This necessitates the initialization and clean up of the DB-Library DLL data structures through calls to the dbinit and dbwinexit functions. Because dbinit initializes private DB-Library structures and to maintain compatibility with future versions of DB-Library, you should call dbinit for all environments.
     
      

  2.   

    u can see more details and samples via MSDNGood luck!
      

  3.   

    你可以使用try.....catch来避免数据库发生联接错误时内存猛涨,并在try设置断点,来调试它
      

  4.   

    我在db_library的err_handel中加了处理,但是有时程序走不到err_handel中.
    这如何办?