on 02-23-2005 4:10 PM
I am using Delphi 5, SAP DI API for SAP 2004.
On a users machine, when we try to connect, we get an error "Access violation at 02271d4a in module observerdll.dll read address 00000000".
Anyone know why they could be getting this error? And what I need to do to fix it?
thanks
Bill
Some more info..
The client did NOT find observerdll.dll on his machine. He does have the DI Server installed and running (not sure if that has anything to do with it).
They are running SBO 6.70.178, 2004A, SP: 00 PL: 09
Message was edited by: Bill Vanselow
Message was edited by: Bill Vanselow
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
What is the type of your oCompany?
In my machine, observerdll.dll is in C:\temp\SM_OBS_DLL\670185.
Could you try the following code?
uses SAPbobsCOM_TLB;
...
private
oCompany : SAPbobsCOM_TLB.Company;
procedure TForm1.Button1Click(Sender: TObject);
var
lErrCode : Longint;
sErrMsg : WideString;
begin
// **********************************************************
// Connecting to the company
// **********************************************************
oCompany := SAPbobsCOM_TLB.CoCompany.Create;
oCompany.Server := '(local)'; // Name of your SBO server
oCompany.CompanyDB := 'SBODemo_PT'; // Name of the company your using
oCompany.UserNAme := 'manager'; // SAP User
oCompany.PassWord := 'manager'; // SAP Password
oCompany.language := ln_Portuguese ;
oCompany.UseTrusted := False; // This property depends on you Windows,
If oCompany.Connect <> 0 then
begin
oCompany.GetLastError(lErrCode, sErrMsg);
ShowMessage('Unable to connect to SAP Database ' + sErrMsg);
end;
end;
Ribeiro Santos
Only difference in the code, is I use the following code to create the oCompany object ...
uses SAPbobsCOM_TLB;
...
private
oCompany : Company;
...
OleCheck(CoCreateInstance(CLASS_Company, nil, CLSCTX_ALL,
IID_ICompany, oCompany));
On my machine, both ways works fine.
The oCompany object is being created, because I call...
oCompany.GetCompanyList;
And it returns the companys found for the SAP db.
The problem is I have not been able to reproduce the problem on any of the machines in my office, this is only happening on a client machine. They have just the SAP client, and our program that uses the DI API.
I have instructed my client to search for that dll, and try to rename it, and rerun it. Not sure whether this will fix it or not.
Here is some example code I am using, I do not at this time know the exact point where the error is returning from, I assume from the Connect function.
function TtcSAP.Connect: string;
begin
// return empty on success
Result := '';
try
// make sure it was created
if not Assigned(oCompany) then
begin
Result := 'Error creating Company object.';
Exit;
end;
if oCompany.Connected then
oCompany.Disconnect;
// Specify the user name and password
oCompany.UserName := sUserName;
oCompany.Password := sPassword;
oCompany.DbUserName := sDbUserName;
oCompany.DbPassword := sDbPassword;
oCompany.UseTrusted := bUseTrusted;
// misc settins
oCompany.language := ln_English;
// Specify the Company database
oCompany.CompanyDB := sCompanyDB;
// specify the server
oCompany.Server := sServer;
// connect (0 = success)
if oCompany.Connect() <> 0 then
begin
Result := GetLastError;
if Trim(Result) = '' then
Result := 'Connection failed.';
end;
except
on E: Exception do
Result := E.Message;
end;
end;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
It seems that you haven't initialize an object.
Can you post your code? Or where is the error?
This happens just in one machine, and others works well?
Ribeiro Santos
Message was edited by: Ribeiro Santos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
6 | |
5 | |
5 | |
5 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.