if i have an entitydatasource control in my aspx (which looks like so
and was created by the configure wizard in the designer and works)
<asp:EntityDataSource ID="edsFuelPrices" runat="server"
EnableFlattening="False" EntitySetName="dieselprices" Select="it.[date], it.[NYMarineDiesel]">
I want to build that in the code behind and remove all the attributes from the aspx markup.
Why doesnt the following work? I get errors on the load "The query syntax is not valid. Near escaped identifier '[NYMarineDiesel]', line 1, column 21" even though NYMarineDiesel is a valid column in the table
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
' when page loads for the first time just show the Marine diesel prices
edsFuelPrices.ConnectionString = "name=enerteckEntities"
edsFuelPrices.DefaultContainerName = "enerteckEntities"
edsFuelPrices.EnableFlattening = False
edsFuelPrices.EntitySetName = "dieselprices"
'edsFuelPrices.Include = "Date,NYMarineDiesel"
edsFuelPrices.Select = "it.[Date], it[NYMarineDiesel]"
Catch ex As Exception
MsgBox("An error occurred while loading this page: " & ex.Message.ToString())
'need to add the code on postbacks, the data returned for the chart is determined by what checkboxes are checked in the checkboxlist
'FormatXAxisLabels(chtFuelPrices, "MainChartArea", 9)
FormatYAxisLabels(chtFuelPrices, "MainChartArea", 9)
FormatLineCharts(chtFuelPrices, True, "MainLegend", "Fuel Types")
Aren't you missing a dot between 'it' and the property name? - you have it[NYMarineDiesel] and I believe you should have it.[NYMarineDiesel]"