Mysql Vb.NET连接 [英] Mysql Vb.NET Connection

查看:53
本文介绍了Mysql Vb.NET连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!



我正在将程序远程连接到mysql。但是,我发现我的程序执行速度太慢。这背后有一个主要原因吗?或者我的mysql选择,更新和删除语句是否被错误编码?我使用这些格式:



Hi guys!

I'm connecting my program to mysql remotely. However, I find the execution of my program too slow. Is there a major reason behind this? Or does my mysql select, update, and delete statements are incorrectly coded? I use these formats:

Dim atlogin As String = "Select * from tbname"

Dim dalogin As New MySqlDataAdapter(atlogin, con)

Dim dslogin As New DataSet()

dalogin.Fill(dslogin, "tbname")





和这个:







and this:


Dim addlogin As New MySqlCommand

     Dim auditdate As Date = dtime2.Date.ToString("MM/dd/yyyy")

    addlogin = New MySqlCommand("INSERT INTO tbname VALUES ('" & variable & "','" & variable & "','Logged        in','" & variable & "','" & variable & "','" & variable & "')", con1)

     addlogin.ExecuteNonQuery()







提前谢谢!




Thanks in advance!

推荐答案

您正在连接远程服务器上的数据库。因此,连接到它并获取数据将会变慢,这也将取决于网络速度。



另一个问题是......不要使用 * ,而是提供所需的列名。

You are connecting the Database, which is present on remote server. So, connecting to it and fetching data will be slower and it will also depend on the Network speed.

Another issue is... Don't use *, rather provide the required column names.
Dim atlogin As String = "Select * from tbname"





关注 - 3种加快MySQL的方法 [ ^ ]了解更多有关查询的信息优化技术。

另一个不错的技巧 - 远程MySQL服务器上的连接速度缓慢。 [ ^ ]。



希望它可以帮助你...... :)



Follow - 3 Ways to Speed Up MySQL[^] to know more on Query optimization techniques.
Another nice trick - Slow connections on Remote MySQL servers.[^].

Hope it helps you... :)


这篇关于Mysql Vb.NET连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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