删除vb.net中的表 [英] deleting table in vb.net

查看:62
本文介绍了删除vb.net中的表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用vb.net删除数据库中的一些表我是怎么做到的?数据库名称是EM

表名由文本框提供。

请帮助我

解决方案

危险!但很容易。 SQL语句:

  DROP   TABLE  myTableName 


如果你想删除表格结构

  Dim  cmd 作为  OleDbCommand(   DROP TABLE tablename,myconnection)

cmd.ExecuteNonQuery()





如果您只想删除表数据

  Dim  cmd 作为  OleDbCommand( < span class =code-string> Delete * from tablename,myconnection)

cmd.ExecuteNonQuery()


< blockquote> Dim Query as String =DROP TABLE& TextBox.Text



Dim Cmd As New OleDb.OleDbCommand(查询,我的连接)



Cmd。 ExecuteNonQuery()



Rem将所需的表名输入到应该运行的TextBox中


i need delete some table in database using vb.net how i do it? database name is EM
table name is give by textbox.
pls help me

解决方案

Dangerous! But easy. SQL statement:

DROP TABLE myTableName


If you want to delete table structure also

Dim cmd As New OleDbCommand("DROP TABLE tablename", myconnection)

cmd.ExecuteNonQuery()



if you only wants to delete table data

Dim cmd As New OleDbCommand("Delete *from tablename", myconnection)

cmd.ExecuteNonQuery()


Dim Query as String="DROP TABLE " & TextBox.Text

Dim Cmd As New OleDb.OleDbCommand("Query, myconnection)

Cmd.ExecuteNonQuery()

Rem Type in your desired table name to TextBox That should run


这篇关于删除vb.net中的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆