I try to get year from a column UPDATE_DATE in a SQL Server database. And I want to display it in a dropdownlist. But, I get this error:
DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'UPDATE_DATE'
Here is my source code: If i remove YEAR from that, it will not show the error. how actually the correct way to do this using YEAR
strsql = "SELECT DISTINCT year(UPDATE_DATE) FROM [FixedAssetMaster_old] "
da = New SqlDataAdapter(strsql, Conn)
Dim ds2 As New DataSet()
da.Fill(ds2)
da.Dispose()
ddlFinYear.DataSource = ds2
ddlFinYear.DataTextField = "UPDATE_DATE"
ddlFinYear.DataValueField = "UPDATE_DATE"
ddlFinYear.DataBind()
ddlDept.Items.Insert(0, "")
ds2.Dispose()
Can anyone give me some advice? Thanks in advance