我正在將負載運行多個程序存儲在頁面上預先填充文本框在頁面內更改存儲過程。VB.net一個SQL連接
,而不用打開,我想使用不同的存儲過程,我想知道是否有可能一個連接中多次改變每次關閉連接。
如這樣的:
Using myConnection1 = New SqlConnection("connectionString")
myConnection1.Open()
Dim myCommand As New SqlCommand("storedProdure1", myConnection)
myCommand.CommandType = CommandType.StoredProcedure
'additional code here
End Using
Using myConnection2 = New SqlConnection("connectionString")
myConnection2.Open()
Dim myCommand As New SqlCommand("storeProcedure2", myConnection2)
myCommand.CommandType = CommandType.StoredProcedure
'additional code here
End Using
可以像這樣的東西來代替:提前
Using myConnection1 = New SqlConnection("connectionString")
myConnection1.Open()
Dim myCommand As New SqlCommand("storedProdure1", myConnection)
myCommand.CommandType = CommandType.StoredProcedure
'additional code here
myCommand.alterSqlCommand("storedProcdure2", myConnection)
'additional code here
End Using
感謝
完美的工作一種享受,謝謝! – 2014-10-31 14:47:36