问:删除表并检查表是否存在 [英] Q: Drop table and check if table exists
问题描述
嗨
我正在尝试使用以下方式删除表格:
Dim cmd As New OleDbCommand(" DROP TABLE)如果EXISTS书籍,myconnection
cmd.ExecuteNonQuery()
但我收到语法错误:DROP TABLE中的语法错误或者DROP INDEX
任何人都可以告诉我如何在删除之前检查表格是否存在或
删除它?
另外,有人可以告诉我如何使用与现有表相同的
结构创建一个新表但不包含其中的数据(在VB.net中
)那是 - 我可以在Access中完成,但我需要在VB代码中完成。
提前谢谢
Geoff
Hi
I''m trying to drop a table by using:
Dim cmd As New OleDbCommand("DROP TABLE IF EXISTS books", myconnection)
cmd.ExecuteNonQuery()
but I get a syntax error: "Syntax error in DROP TABLE or DROP INDEX"
Can anybody tell me how to check whether a table exists before deleting or
dropping it?
Also, could somebody tell me how to create a new table with the same
structure as an existing table but not the data within it (within VB.net
that is - I can do it in Access but I need to do it in VB code).
Thanks in advance
Geoff
推荐答案
你好Geoff,
我没有在你的消息中发送该代码吗?
然而,当我的视线下降时,你不需要它。
Cor
Hi Geoff,
Did I not send that code in a message of yours?
However when that drops works than you do not need that in my opinion.
Cor
您好Cor
不,您确实发送了一个链接,其中包含有关DROP TABLE的详细信息,但是没有涵盖
是否有任何详细信息表格已存在。
Geoff
Cor Ligthert <无********** @ planet.nl>在消息中写道
news:uS ************** @ TK2MSFTNGP10.phx.gbl ...
Hi Cor
No, you did send a link with details about DROP TABLE but that didn''t cover
any details as to whether the table existed.
Geoff
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:uS**************@TK2MSFTNGP10.phx.gbl...
嗨Geoff,
我没有在你的消息中发送该代码吗?
然而,当我认为那种下降工作比您不需要时那样。
Cor
Hi Geoff,
Did I not send that code in a message of yours?
However when that drops works than you do not need that in my opinion.
Cor
Geoff,
如果您的第一个问题,请参阅Ken的这条消息
http://www.google.com/gr*************************@TK2MSFTNGP11.phx.gbl
这是我的第二个
http://www.google.com/gr**************** **********************@news.dial .pipex.com
我希望这有帮助?
Cor
Geoff,
See this message from Ken for your first question
http://www.google.com/gr*************************@TK2MSFTNGP11.phx.gbl
And this from me for your second
http://www.google.com/gr**************************************@news.dial .pipex.com
I hope this helps?
Cor
这篇关于问:删除表并检查表是否存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!