ODBC error when using SQL delete from dBase table 
Author Message
 ODBC error when using SQL delete from dBase table

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:

----------------------------------------------------------------------------
'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
----------------------------------------------------------------------------

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



Fri, 24 May 2002 03:00:00 GMT  
 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

------------------------------------------------------------------------
----

- Show quoted text -

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.


Sat, 25 May 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. ODBC error when using SQL delete from dBase table

2. Deleting entry from table using ODBC - please help

3. Error: 40002 - 01S03: [Microsoft][ODBC SQL Server Driver]No rows updated or deleted

4. Error 3131 Syntax error in FROM clause - using SQL accessing external ODBC problem

5. Error : 40002 - 01S03: [Microsoft][ODBC SQL Server Driver]No rows updated or deleted

6. Error 3131 Syntax error in FROM clause - using SQL accessing external ODBC problem

7. SQL FoxPro ODBC Table Query using Current Date

8. Exclusive table locking using ODBC and Access97 or SQL 6.5

9. Strange ODBC errors using DAO to access linked tables

10. Delete dbase table

11. Page Fault error accessing Informix tables using Intersolv ODBC Driver

12. ODBC with dBase Tables

 

 
Powered by phpBB® Forum Software