哪个是从VB.NET 2015连接SQL Server2014的最佳方法 [英] Which is the best way to connect SQL server2014 from VB.NET 2015

查看:326
本文介绍了哪个是从VB.NET 2015连接SQL Server2014的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

美好的一天!



我需要知道什么是最好,最有效和最快的连接方式使用VB.NET 2015的MS SQL SERVER 2014数据库



我也在使用这个组合,但问题是什么时候直接在SQL Server查询编辑器中执行查询它只需1-2秒即可检索由近10,000行组成的数据。

但是当我在VB.NET应用程序中执行相同的查询并填充datagridview时,它会耗费30-40秒意味着比查询的实际检索时间慢20倍。



请有人帮我弄明白错误是什么。



谢谢

Muhammad Asim Mughal



我的尝试:



我需要一个通用解决方案而不专门共享代码。

解决方案

一般来说你不应该查询了很多r ows,你应该出于性能原因分页结果。



DataGridView 显示行的开销很大,你的实际查询结果应该是你提到的2秒(如果在你的客户端机器上完成,如果没有,那么你也需要考虑网络开销)。



如果SQL Server上的查询占用10,000行需要2秒,那么您应该考虑正确索引您的查询(我认为它应该更快但不能确定,因为我不知道查询模式,表和列的详细信息使用)。

Hello,
Good Day!

I need to know what is the Best, The Most Efficient and The Fastest way to connect MS SQL SERVER 2014 Database using VB.NET 2015

I am also working in this combination but the problem is that when is execute a query directly in the SQL Server Query Editor it retrieves the the data that is consisted of almost 10,000 rows in just 1-2 seconds.
But when i execute the same query in VB.NET application and fill the datagridview it consumes 30-40 seconds that means the 20 times slower that the actual retrieval time of the query.

Please anyone can help me to figure it out what the mistake is in fact.

Thanks
Muhammad Asim Mughal

What I have tried:

I Need A General Solution without sharing the code specifically.

解决方案

Generally you should not query a lot of rows, you should page the results for performance reasons.

The DataGridView has a lot of overhead for displaying rows, your actual query results should take the 2 secs you mentioned (if it is done on your client machine, if not then you also have the network overhead to consider).

If the query on SQL Server takes 2 secs for 10,000 rows then you should look into indexing your query properly (it should be faster I presume but can not be sure since I don't know the details of your query schema, tables and columns used).


这篇关于哪个是从VB.NET 2015连接SQL Server2014的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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