Through Automation Object COM function, accessing SQL Server Database
Posted on 2004-04-20
I created Automation Object (COM) using Delphi. I created a function in that COM which will gather some data from some text files and insert them into MS-SQL table. Every time I call that function it should connect to the database to post new data.
I succeeded in gathering my data from text file throu' the method from COM object but I failed to connect to the database. I tried to use ODBC(with BDE components, with ADO Components)
In more details:
COM Automation Object has function which has following input parameters as strings & get output string parameter. It sends ODBC DataSource( to access MS SQL Server), Table Name, UserID & Pwd parameters to update database.
function ImpExec(const pDataSource, pTable, pUser ID, pPwd: WideString): WideString; safecall;
From Delphi exe Application, when I try to call this method providing input parameters by using the above Object, it give the following error
'Project raised exception class EOleException with message 'Catastrophic failure'
What could be the error, I couldn't access database by using this method from that COM Object.
Also how to debug the Com Object from exe application.
Expecting a solution soon.