Link to home
Start Free TrialLog in
Avatar of adamtrask
adamtrask

asked on

Trying to count the number of records where date column = 2010

Hello,

Now I am trying to count the number of records where the date column (dDate) contains 2010.
The error I am getting is a "clash" between date and integer.

I am used the following select count statement as listed below:


mySqlcommand = New Sqlcoomand("Select count(*) where dDate = @dDate",con)
comm.Parameters.AddWithValue("@dDate", System.Data.SqlDbType.Date)
comm.Parameters("@dDate").Value = curYear
 Dim count As Integer
        con.Open()
        count = comm.ExecuteScalar
        Me.txtMonthTests.Text = count.ToString
        con.Close()

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Paul MacDonald
Paul MacDonald
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of adamtrask
adamtrask

ASKER

It's a date column
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you all