Home > Back-end >  Sql Server query analyzer calls to functions of Delphi
Sql Server query analyzer calls to functions of Delphi

Time:10-22

In Delphi to establish a "library IDSAC;" , at the same time, add a DataModule (DM1), on which the add ADOConnection1, ADOQ, ADOConnection1 mainly connect to a Sql Server Server, test with local Sql, the Dll has been created, to perform the corresponding operation in the Sql Server, appear "failed to find stored procedure", as shown in the program listing
Part 1, Delphi
The function IDSC (a, b: integer) : integer; Stdcall;
The begin
Try
CoInitialize (nil);
DM1:=DM1. Create (application);
Dm1. ADOConnection1. The ConnectionString:='Provider=SQLOLEDB. 1; Password=sa; Persist Security Info=True; User ID=sa; Initial Catalog=test; Data Source=. Use Procedure for Prepare=1; Auto Translate=True; ';
Dm1. ADOConnection1. Connected:=TRUE;
Dm1. ADOQ. SQL. Text:="insert into test (a, b) values (' + inttostr (a) + ', '+ inttostr (b) +') './/a, b, as an integer type
Dm1. ADOQ. ExecSQL;
Result:=1;
Except,
Result:=0;
end;
Freeandnil (DM1);
end;

Exports
IDSC name 'ids';


Part 2, the Sql Server query analyzer.

The exec sp_addextendedproc 'IDSAC', 'c: \ test \ IDSAC DLL'

The EXEC IDSC 1, 2

The following error:


Server: 2812, level 16, 62, line 1
Unable to find a stored procedure 'IDSC,

CodePudding user response:

The DLL as a database stored procedure and asked for the DLL interface to a certain extent, format of
Not any DLL can be
  • Related