I have the following code which I use to fill my datalist.
selectCMD1 = New SqlCommand()
selectCMD1.Connection = dbconn
selectCMD1.CommandTimeout = 30
selectCMD1.CommandText = "Select loginID, entity, amount, CONVERT( char(10), dates, 101), year from memberships where loginID = '" & empDS.tables("employeeinfo".Rows(0).Item("loginID" & "'"
empDA.SelectCommand = selectCMD1
dbconn.Open()
empDA.Fill(empDS, "memberships"
memberinfo.DataSource = empDS.Tables("memberships"
memberinfo.DataBind()
dbconn.Close()
I have the following list I create using this code.
<asp:datalist ID="memberinfo" BorderColor="#000000" BorderWidth="0" CellPadding="5" CellSpacing="5" CssClass="apartmenttable" ForeColor="#0000CC" runat="server">
<headertemplate>
<td align="center" width="100" class="apartmentwhite">
Date
</td>
<td align="center" width="100" class="apartmentwhite">
Entity
</td>
<td align="center" width="100" class="apartmentwhite">
Amount
</td>
</headertemplate>
<itemtemplate>
<td align="center" width="100" class="apartmentinside">
<%# Container.DataItem( "dates" ) %>
</td>
<td align="center" width="100" class="apartmentinside">
<%# Container.DataItem( "entity" ) %>
</td>
<td align="center" width="100" class="apartmentinside">$
<%# Container.DataItem( "amount" ) %>
</td>
</itemtemplate>
</asp:datalist></p>
Right now I get an error saying
dates is neither a DataColumn nor a DataRelation for table memberships. Any ideas how to solve this. I am sure it is because of my convert statement
selectCMD1 = New SqlCommand()
selectCMD1.Connection = dbconn
selectCMD1.CommandTimeout = 30
selectCMD1.CommandText = "Select loginID, entity, amount, CONVERT( char(10), dates, 101), year from memberships where loginID = '" & empDS.tables("employeeinfo".Rows(0).Item("loginID" & "'"
empDA.SelectCommand = selectCMD1
dbconn.Open()
empDA.Fill(empDS, "memberships"
memberinfo.DataSource = empDS.Tables("memberships"
memberinfo.DataBind()
dbconn.Close()
I have the following list I create using this code.
<asp:datalist ID="memberinfo" BorderColor="#000000" BorderWidth="0" CellPadding="5" CellSpacing="5" CssClass="apartmenttable" ForeColor="#0000CC" runat="server">
<headertemplate>
<td align="center" width="100" class="apartmentwhite">
Date
</td>
<td align="center" width="100" class="apartmentwhite">
Entity
</td>
<td align="center" width="100" class="apartmentwhite">
Amount
</td>
</headertemplate>
<itemtemplate>
<td align="center" width="100" class="apartmentinside">
<%# Container.DataItem( "dates" ) %>
</td>
<td align="center" width="100" class="apartmentinside">
<%# Container.DataItem( "entity" ) %>
</td>
<td align="center" width="100" class="apartmentinside">$
<%# Container.DataItem( "amount" ) %>
</td>
</itemtemplate>
</asp:datalist></p>
Right now I get an error saying
dates is neither a DataColumn nor a DataRelation for table memberships. Any ideas how to solve this. I am sure it is because of my convert statement