Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

EOleException: Unspecified Error

Status
Not open for further replies.

Griffyn

Programmer
Jul 11, 2002
1,077
AU
Hi all,

Working with an Access 97 database with a simple table. I have many queries that work with it, but one is raising an exception when I open it. The first bit of code shows where I set up the TADOConnection object:
Code:
[navy][i]// for automatic syntax highlighting see faq102-6487 
[/i][/navy]
[b]procedure[/b] TCopyBak2.ServiceStart(Sender: TService; [b]var[/b] Started: Boolean);
[b]begin[/b]
  CoInitialize([b]nil[/b]);
  LocalConnection.ConnectionString := Format([teal]'Provider=Microsoft.Jet.OLEDB.4.0;'[/teal]
    + [teal]'Data Source=%sCopyBak2.mdb;Persist Security Info=False'[/teal],
    [ExtractFilePath(ParamStr([purple]0[/purple]))]);
  LocalConnection.Open;       [navy][i]// activate local database
[/i][/navy][navy][i]// snip
[/i][/navy][b]end[/b];
And this bit is the method containing the problem
Code:
[b]procedure[/b] TCopyBak2.UpdateTransferPosition(AID: Integer; APos: Int64);
[b]begin[/b]
  [b]with[/b] TADOQuery.Create([b]nil[/b]) [b]do[/b]
    [b]try[/b]
      Connection := LocalConnection;
      SQL.Text := Format([teal]'SELECT Transfers.ID, Transfers.Position FROM Transfers '[/teal]
        + [teal]'WHERE (Transfers.ID)=%d'[/teal], [AID]);
        Open;  [navy][i]// causes exception
[/i][/navy][navy][i]// snip
[/i][/navy][b]end[/b];

I have the last Open method trapped in a try..except block, and E.Message = '(EOleException) Unspecified error'. I've searched the web for this, and my last try was to add the [tt]Transfers.[/tt] bit before each column, but it's made no difference.

This procedure gets called way off in the middle of my service app, and I have many other queries constructed in this way on the same table - but not necessarily with the same fields or filters - and they work ok.

The table's Primary key is on the ID field. There are no other indexes. The table has about 8 records, all of which were added by my delphi program.

Any clues?
 
what do you get if you run the query via access?


-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
Runs fine in Access. Changing the SELECT clause toquery to
Code:
SELECT * FROM Transfers...

lets the query run just fine in my program, and I can edit fields as I intended. I'll run with this for the moment, but it's got me scratching my head. I guess it's a bug in the ADO or JET layer?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top