Table already exists exception

I

Irfan

hi, All

I have a table in Access and I am using a storedProcedure (Make-Table query)
to overwrite this table.

It gives an error that 'Table Already Exists', which is true. But i want it
to continue overwriting the existing table and not stop and give me an
error.
In VB6 i would have used On error resume Next, but i havent got grips yet
with VB.net exception handling.
Can someone please tell me how to tell the program to continue when this
error message occurs.

TIA
irfan
 
O

Oenone

Irfan said:
In VB6 i would have used On error resume Next, but i havent got
grips yet with VB.net exception handling.
Can someone please tell me how to tell the program to continue when
this error message occurs.

\\\
Try
[Create the table here]
Catch
'An error occurred but we're going to ignore it
End Try

[rest of your code here]
///

I think there are much better ways to do this, but to directly answer the
question, the above should do what you want.
 
P

Paul Clement

¤ hi, All
¤
¤ I have a table in Access and I am using a storedProcedure (Make-Table query)
¤ to overwrite this table.
¤
¤ It gives an error that 'Table Already Exists', which is true. But i want it
¤ to continue overwriting the existing table and not stop and give me an
¤ error.
¤ In VB6 i would have used On error resume Next, but i havent got grips yet
¤ with VB.net exception handling.
¤ Can someone please tell me how to tell the program to continue when this
¤ error message occurs.
¤

You can't overwrite the table. It must be dropped from the database first. You can use SQL:

DROP TABLE TableName


Paul
~~~~
Microsoft MVP (Visual Basic)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top