我已经在我的 PC 中安装了 Sql Server Management Studio。
然后远程连接到我的一个数据库
我执行一个查询,该查询在近 1 或 2 秒内返回 6000 条记录, 但是当我从 .Net 应用程序(WPF 桌面)也从同一台 PC 运行相同的查询时,数据传输几乎需要 8-9 秒
我在 .Net 中的代码非常简单明了
这是代码
Private Sub Button_Click(sender As Object, e As RoutedEventArgs)
Dim Sql_Connection As New SqlClient.SqlConnection("MyRemoteSQLConnectionString")
Dim Sql_Command As New SqlClient.SqlCommand("select Col1,Col2,Col3,Col4,Col5,Col6 from Table", Sql_Connection)
Sql_Connection.Open()
dr = Sql_Command.ExecuteReader
Dim DataTable As New DataTable
DataTable.Load(dr)
'The above code takes 8-9 seconds to finished but in ssmo takes only 1-2 seconds for 6000 Records
Sql_Connection.Close()
End Sub
为什么会这样?剂量 ssms 有不同的方式来管理传输的数据?