Modify Delphi to adapt to SQL Server2000

zhaozj2021-02-08  224

After the SQL Server 7.0 is changed to SQL Server 2000, it is wrong to perform normal programs. Take a closer look, it turns out that SQL Server 2000 changes the return parameter of the stored procedure (Return_Value is changed to @return_value). Let us make a change in AdoDB to make it compatible with 7.0 and 2000.

1. Use File -> Open Project to open Source / Vcl / Adodb.PAS. 2, positioned to Tadoconnection.Willexecute, add the following code after Begin [code] // to be compatible with SQL Server 7.0 and SQL Server 2000 IF (PCommand.Parameters.count> 0) and ((pcommand.parameters [0] .name = 'RETURN_VALUE') or (pcommand.parameters [0] .Name = '@return_value')) The beginness ('DBMS VERSION']. Value <'08.00.0000 'Ten PCommand.Parameters [0]. Name: = 'RETURN_VALUE' Else PCommand.Parameters [0] .name: = '@return_value' end; [/ code] 3, positioning to tadocommand.findparam to join the following code before result = NI [code] // is used to compatibility SQL Server 7.0 and SQL Server 2000 IF (count> 0) AND (value = '@return_value')) The begin result: = items [0]; if (result.name = '@ RETURN_VALUE ') OR (Result.Name =' RETURN_VALUE ') THEN EXIT; END; [/ CODE] 4

转载请注明原文地址:https://www.9cbs.com/read-2877.html

New Post(0)