VB 太慢用delete 命令mysql 清空数据库命令速度有更好的办法?

欢迎加入我们,一同切磋技术。 &
用户名: &&&
密 码: &
共有 3267 人关注过本帖
标题:[求助]请问:怎样用VB ADO来实现对Access数据库表删除的操作?
等 级:新手上路
帖 子:66
&&问题点数:0&&回复次数:10&&&
[求助]请问:怎样用VB ADO来实现对Access数据库表删除的操作?
请问:怎样用VB ADO来实现对Access数据库表删除的操作?
搜索更多相关主题的帖子:
来 自:passerby
等 级:版主
帖 子:4047
专家分:271
跟对SQL操作一样的啊。用COMMADN执行SQL语句
[url=/html/6/6694/]极道金丹[/url][url=/html/2/2849/]九阴九阳[/url][url=/html/2/2596/]凡人修仙传[/url]
等 级:贵宾
威 望:42
帖 子:4881
专家分:671
sql="delete from xxxx where xxxxxxx"
等 级:新手上路
帖 子:66
谁能给一段完整的代码,要是ADO实现的,否则就没有用,帮帮忙把
等 级:新手上路
帖 子:66
等 级:贵宾
威 望:42
帖 子:4881
专家分:671
删除记录还是删除表?
来 自:passerby
等 级:版主
帖 子:4047
专家分:271
Dim oCnn As ObjectDim s_Sql As StringSet oCnn = CreateObject("ADODB.connection")oCnn.connectionstring = "Provider=SQLOLEDB.1;Persist Security Info=FUser ID=pwd=Initial Catalog=zw" oCnn.ConnectionTimeout = 30oCnn.Opens_Sql="delete from xxxx where xxxxxxx"oCnn.Execute (s_Sql)Set oCnn=Nothing
[url=/html/6/6694/]极道金丹[/url][url=/html/2/2849/]九阴九阳[/url][url=/html/2/2596/]凡人修仙传[/url]
等 级:新手上路
帖 子:66
删除表呀,要通过ADO实现的,其他的我也会
等 级:新手上路
帖 子:611
Dim oCnn As ObjectDim s_Sql As StringSet oCnn = CreateObject("ADODB.connection")oCnn.connectionstring = "Provider=SQLOLEDB.1;Persist Security Info=FUser ID=pwd=Initial Catalog=zw" oCnn.ConnectionTimeout = 30oCnn.Opens_Sql="drop table temp"oCnn.Execute (s_Sql)Set oCnn=Nothing
等 级:贵宾
威 望:42
帖 子:4881
专家分:671
我怎么都觉得上面的解答给得很全了……删除表和删除记录有很大区别吗?(技术难度上)
版权所有,并保留所有权利。
Powered by , Processed in 0.023149 second(s), 8 queries.
Copyright&, BCCN.NET, All Rights Reserved使用 VB.NET 连接到 MySQL 数据库 - 开源中国社区
使用 VB.NET 连接到 MySQL 数据库
英文原文:
Introduction
Connecting to a MySQL database from Visual Studio 2012 using a wizard might be a bit tricky, because&MySQL is not supported by default (like SQL Server). With this tip, I will show you how to connect to a MySQL database and run commands (select,update,delete) using VB.NET and I will also&show you how to import MySQL connectors to Visual Studio 2012.
在Visual Studio 2012中使用向导连接到MySQL数据库是一件相当棘手的事情。因为MySQL并不在VS2012默认支持的数据库中(比如SQL Server)。在本文中我将介绍如何使用VB.NET连接到MySQL数据库并且执行SQL语句(SELECT,UPDATE,DELETE),同时我会展示如何将MySQL连接器导入(connectors)到Visual Studio 2012中。
Using the Code
You need to download the mysqlconnect (mysql-connector-net) from the MySQL website and add the DLL files to Visual Studio, the website is&. Extract the download file, for example, in C:\ and go to --& Visual Studio --&
Create a new project in VS2012 and name it whatever you like:
Go to project --& Add reference.
Select the DLL files from your folder and add them to your project.
Create a new VB class, name itmysqldbas follows:
Now you are ready to use the code of the class that I have created to connect to&the MySQL database.& The code for this class is attached with this tip , or from .
Now you can copy the methods from my class or add this class to your project directly, and then use the code in the project, it's up to you. In both cases, you will have a class that connects to a MySQL database and doesselect,update,deleteoperations.
I will add a simpleGridViewto my project and try to get data from the database using very few lines of code. Dim mydb As New mySqlDB
Protected Sub Page_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles Me.Load
Dim dataset As New DataSet
Dim queryresult As String = &&
dataset = mydb.executeSQL_dset(&SELECT COMMAND&, queryresult)
GridView1.DataSource = dataset
GridView1.DataBind()
Catch ex As Exception
When you run the above code, you populate the data from the database in a dataset using theexecuteSQL_dsetfunction. This function will return a dataset that you can then use anywhere in your project.
To run an&updateordeletecommand, there is another method called: Dim dataset As New DataSet
Dim queryresult As String = &&
mydb.executeDMLSQL(&update or delete SQL command&, queryresult)
If queryresult = &SUCCESS& Then
'your command is ok
'your command is not ok
你须要从下载MySQL连接器(mysql-connector-net)并导入到Visual Studio中。解压下载到的文件到指定文件夹,例如C:\。启动Visual Studio。
在VS2012创建一个新的项目,项目名称可以是你任意你喜欢的:
打开project(项目) --& Add reference(添加引用)。
选中刚才下载的DLL文件,将其导入你的项目中。
创建一个新的VB类,命名为itmysqldbas如下所示:
现在你可以直接使用我写的MySQL连接类的代码。我把这个类的代码附在了,或者。
你可以把这个类的代码复制到你的类中,或者干脆你直接把这个类文件放到你的项目中,这完全取决于你的决定。无论你采用哪种方式,你都能得到一个即能连接到MySQL数据库又能执行SELECT、UPDATE、DELETE操作的类。
我将仅仅使用几行代码就添加一个简单的GridView到我的项目中,并试图从数据库中读取数据。 Dim mydb As New mySqlDB
Protected Sub Page_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles Me.Load
Dim dataset As New DataSet
Dim queryresult As String = &&
dataset = mydb.executeSQL_dset(&SELECT COMMAND&, queryresult)
GridView1.DataSource = dataset
GridView1.DataBind()
Catch ex As Exception
当你执行上述代码时,会调用executeSQL_dset这个函数从数据库中获取数据。这个函数会返回一个数据集(dataset),然后你就能在项目中作用它了。
若要执行更新或删除命令,还有另一个方法,如下:
Dim dataset As New DataSet
Dim queryresult As String = &&
mydb.executeDMLSQL(&update or delete SQL command&, queryresult)
If queryresult = &SUCCESS& Then
'your command is ok
'your command is not ok
Hope this was helpful.
MySQL is very small and very easy to download, and it's free (open source). Hopefully with the&above class, you can connect and run (select,update,delete) commands.
I shall try in another post to explain the class in detail in case you want to modify it and make changes.
希望这个篇文章对会对你有用。
MySQL非常小巧、非常容易下载,并且它是免费的(开源的)。希望你能使用上述的类连接到MySQL数据库,并能执行(SELECT,UPDATE,DELETE)命令。
我会在另一篇文章中解释这个类的一些细节上的问题,以方便你自己能修改这个类。&&&&VB 利用DELETE语句删除数据表中的数据
VB 利用DELETE语句删除数据表中的数据
VB 利用DELETE语句删除数据表中的数据
VB 利用DELETE语句删除数据表中的数据
若举报审核通过,可奖励20下载分
被举报人:
举报的资源分:
请选择类型
资源无法下载
资源无法使用
标题与实际内容不符
含有危害国家安全内容
含有反动***等内容
含广告内容
版权问题,侵犯个人或公司的版权
*详细原因:
VIP下载&&免积分60元/年(1200次)
您可能还需要
开发技术下载排行

参考资料

 

随机推荐