0
我不太確定爲什麼我得到這個錯誤。BC3016:變量'myConnection'在封閉塊中隱藏一個變量
Dim numUsers as Integer
Using myConnection as New System.Data.SqlClient.SqlConnection("Data Source=(local);InitialCatalog=dbtest;Integrated Security=True")
Dim queryString As String = "SELECT COUNT(*) AS Num_Of_User FROM tblusers WHERE [email protected] AND [email protected]"
Using myCommand as New System.Data.SqlClient.SqlCommand(queryString, myConnection)
myConnection.Open
myCommand.Parameters.AddWithValue("@username", requestName)
myCommand.Parameters.AddWithValue("@password", requestPass)
numUsers = myCommand.ExecuteScalar()
End Using
End Using
第一個使用狀態時發生此錯誤。任何人都可以解決這個問題
你可以發佈封閉塊嗎?你可能在那裏定義了另一個名爲「myConnection」的變量。 – 2010-07-16 20:39:35