I'm writing a simple Windows PC application in VB.NET using VS 2008 and the .NET 3.5 Framework. My code is intended to simply recycle my MS SQL Error Log. The code for my startup form appears in the code snippet.
All the commands below "Dim CMD As New SqlCommand" have a design time error. There is a blue squiggly line under each object (CN and CMD), and when I hover over the object text, the yellow hover box says "Declaration expected." I am confused as my first two commands (after the "Public Class frmMain" statement) declare both objects.
Any help would be most appreciated.
Thanks, Stu Engelman
Public Class frmMain
Dim CN As New SqlConnection
Dim CMD As New SqlCommand
CN.ConnectionString = "Server=(local);Trusted_Connection=True;"
CMD.Connection = CN
CMD.CommandText = "EXEC sp_cycle_errorlog"
CMD = Nothing
CN = Nothing