其實,我試圖找出wheather的PARTNO在數據庫表中現有的或不和它需要很長一段時間在數= checkCommand.ExecuteReader sataement功能需要很長的時間來執行
請在下面找到
方法Public Function CheckProductNo(ByVal Partno As String) As Boolean
Dim count As SqlDataReader
Dim valid As Boolean = False
Using connection As New SqlConnection
connection.Open()
Using checkCommand As New SqlCommand("PartNo_check", connection)
checkCommand.CommandType = CommandType.StoredProcedure
checkCommand.Parameters.Add(New SqlParameter("@PartNo", Partno))
count = checkCommand.ExecuteReader
If count.ToString > 0 Then
valid = True
End If
End Using
End Using
Return valid
End Function
STORED PROCEDURE
CREATE PROCEDURE PartNo_Check
@PartNo VARCHAR(30)
AS
SELECT PartNo from T_Product where [email protected]
Thanks
「PartNo_check」存儲過程的代碼是什麼?爲什麼你使用SqlDataReader.ToString() – Steve
請找到存儲過程,那麼問題是在checkcommad.executeredaer,我沒有機會進一步看到並做隨機實驗 –
T_Product有多少行?如果它很大,你可能想要考慮在PartNo –