我轻松地解决了这个问题。我进入了我的数据集的设计师代码(dataset1.designer.vb
),找到了以下命令:Me._commandCollection(0)
,Me._commandCollection(1)
到 Me._commandCollection(5)
,因为我总共有五个命令针对我的 SQL Server 2008 数据库执行。在每个(0 到 5)这些命令中,我写了 Me._commandCollection(0).CommandTimeout = 60
,其中我将 0 更改为其他四个命令的下一个数字。这五个命令中的每一个都有一段代码块,其中两个块如下所示,以提供给您一个示例。
Me._commandCollection = New Global.System.Data.SqlClient.SqlCommand(5) {}
Me._commandCollection(0) = New Global.System.Data.SqlClient.SqlCommand()
Me._commandCollection(0).Connection = Me.Connection
Me._commandCollection(0).CommandTimeout = 60
Me._commandCollection(0).CommandText = "SELECT MK_QR_SUB_AND_DETAIL.*" & _ "Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10)" & _ "FROM MK_QR_SUB_AND_DETAIL"
Me._commandCollection(0).CommandType = Global.System.Data.CommandType.Text
Me._commandCollection(1) = New Global.System.Data.SqlClient.SqlCommand()
Me._commandCollection(1).Connection = Me.Connection
Me._commandCollection(1).CommandTimeout = 60
Me._commandCollection(1).CommandText = "dbo.spQtrRptTesting_RunInserts_Step1of4"
Me._commandCollection(1).CommandType = Global.System.Data.CommandType.StoredProcedure
Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", ""))
Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@pStartADate", Global.System.Data.SqlDbType.[Date], 3, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", ""))
Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@pEndADate", Global.System.Data.SqlDbType.[Date], 3, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", ""))
Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@pStartBDate", Global.System.Data.SqlDbType.[Date], 3, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", ""))
Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@pEndBDate", Global.System.Data.SqlDbType.[Date], 3, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", ""))