
ODBC error when using SQL delete from dBase table
Try the following code. It will print out all the error messages
associated with your failed delete. You'll find this much more
descriptive than "ODBC call failed: error 3146". Without knowing
anymore about your problem, I'm betting you'll find it's a permission
error in the database.
dim DBError as error
on error goto FULL_ERROR_MESSAGE
'your code goes here.
FULL_ERROR_MESSAGE:
For Each DBError In DBEngine.Errors
With DBError
MsgBox .number & " " & .Description
End With
Next DBError
End If
Quote:
> Hi all,
> I've got a pretty weird problem here. I'm connecting to a
> dBase IV table and allowing the user to insert or delete
> records.
> On my development PC everything works like a charm. On the
> client PC the SQL delete fails with an ODBC "3146" error.
> Here's the DELETE code:
------------------------------------------------------------------------
----
Quote:
> 'Create the workspace
> Set wsDBase = CreateWorkspace("ODBCWorkspace", "", "", dbUseODBC)
> 'Create a database connect string
> DSN = "DSN=dBASE Files"
> DBQ = "DBQ=" & Trim$(Left$(frmMain.txtDestination,
> Len(frmMain.txtDestination) - 1))
> ConnectString$ = "ODBC;" & DSN & ";" & DBQ
> 'Open the dBase IV User Table and delete the record
> Set cnDBase = wsDBase.OpenConnection("Conn1", dbDriverNoPrompt,
False,
> ConnectString$)
> cnDBase.Execute "DELETE FROM " & BADGE_TABLE_NAME & " WHERE BADGE
= '" &
> Trim$(lstBadges.Text) & "'"
> 'Close the connection and workspace
> cnDBase.Close
> wsDBase.Close
------------------------------------------------------------------------
----
Quote:
> The code fails right on the EXECUTE line. I've checked the
> "Updateable" parameter for the connection, and it is
> properly updateable. The SQL is correct. And, as I
> mentioned, this works 100% fine on my development PC.
> I've installed the latest ODBC drivers (or MDAC, or whatever
> the hell Microsoft is calling it these days), but it hasn't
> helped. I even went as far as installing the VB6 development
> environment on the client PC, so I know for sure it's failing
> on that EXECUTE line, but even that hasn't helped.
> Any idea why I can't do a simple SQL DELETE from a dBase IV
> table using ODBC (or why it's working on one PC and not
> another)? Is there something special I need to do? Is there a
> secret driver I'm missing? No suggestion is too wacky...I'll
> take all theories! TIA.
> - Dave
Sent via Deja.com http://www.deja.com/
Before you buy.