Hi!
I have the following code but I get blue squiggly line in cnn and when i point my mouse pointer on it i see this message "Variable 'cnn' hides a variable in an enclosing block"i have this on form loadCode:Private Sub BtnLockUnlock_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnLockUnlock.Click Dim IsLocked As Boolean = FpSpread1.ActiveSheet.DefaultStyle.Locked ''Dim imageIcon As String = IIf(IsLocked, "lock_icon.gif", "lock_icon_open.gif") If IsLocked = True Then FpSpread1.ActiveSheet.DefaultStyle.Locked = False Using cnn As New SqlConnection("My.Settings.ConnectionString") Using cnn As New SqlCommand("UPDATE tblLockUnlock SET Locked=@Bol WHERE Period=@Per", cnn) cnn.Parameters.AddWithValue("@Bol", "False") cnn.Parameters.AddWithValue("@Per", "1G_HS") cnn.ExecuteNonQuery() End Using End Using Else FpSpread1.ActiveSheet.DefaultStyle.Locked = True End If Call LockUnlockImage() End Subwhat's wrong with my code?Code:cnn = New SqlConnection(My.Settings.ConnectionString)




Reply With Quote