Connecting to MS SQL Server 2005 via Web Service

Posted by clear-cycle-corp on Stack Overflow See other posts from Stack Overflow or by clear-cycle-corp
Published on 2010-04-16T19:48:54Z Indexed on 2010/04/16 19:53 UTC
Read the original article Hit count: 350

Filed under:
|
|
|
|

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

© Stack Overflow or respective owner

Related posts about delphi

Related posts about 2010