01.
Dim
dt
As
New
DateTime(MyYear, MyMonth, 1)
02.
Dim
sql
As
String
=
"SELECT RIGHT(CONVERT(NVARCHAR(10), MyDate, 103), 7) AS MonthYear FROM MyTable WHERE YEAR(MyDate) = @Year AND MONTH(MyMonth) = @Month"
03.
04.
Using cmd
As
SqlCommand = con.CreateCommand()
05.
cmd.CommandType = CommandType.Text
06.
cmd.CommandText = sql
07.
cmd.Parameters.AddWithValue(
"@Year"
, dt.Year)
08.
cmd.Parameters.AddWithValue(
"@Month"
, dt.Month)
09.
...
10.
...
11.
...
12.
End
Using