Connecting to MS SQL Server 2005 via Web Service
- by clear-cycle-corp
Delphi 2010, dbExpress, and MS SQL Server 2005 DB
Ok,
I am trying to make a connection to a MS SQL 2005 DB using Delphi 2010 & DBExpress.
If I create a standard delphi application and hard code my connection (IT WORKS!):
procedure TForm1.Button1Click(Sender: TObject);
var
Conn: TSQLConnection;
begin
Conn:= TSQLConnection.Create(nil);
Conn.ConnectionName:= 'VPUCDS_VPN_SE01';
Conn.LoadParamsOnConnect := True;
Conn.LoginPrompt:=True;
try
Conn.Connected:= True;
if Conn.Connected then
ShowMessage('Connected!')
else
ShowMessage('NOT Connected!')
finally
Conn.Free;
end;
end;
All the ini files, and DLLs reside in the same folder as my executable
and yes, I have DBXMsSQL & MidasLib in the uses clause
again, it works if its not a web service!
However, if i then move the code over to a Web serices CGI module:
function TTest.ConnectToDB: Boolean;stdcall;
var
Conn: TSQLConnection;
begin
Conn:= TSQLConnection.Create(nil);
Conn.ConnectionName:= 'VPUCDS_VPN_SE01';
Conn.LoadParamsOnConnect := True;
Conn.LoginPrompt:=True;
try
Conn.Connected:= True;
result:= Conn.Connected;
finally
Conn.Free;
end;
end;
Thanks