entitydatasource


building entity data source control from code behind


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"
ConnectionString="name=enerEntities" DefaultContainerName="enerEntities"
EnableFlattening="False" EntitySetName="dieselprices" Select="it.[date], it.[NYMarineDiesel]">
</asp:EntityDataSource>
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
Try
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())
End Try
Else
'need to add the code on postbacks, the data returned for the chart is determined by what checkboxes are checked in the checkboxlist
End If
'FormatXAxisLabels(chtFuelPrices, "MainChartArea", 9)
FormatYAxisLabels(chtFuelPrices, "MainChartArea", 9)
FormatLineCharts(chtFuelPrices, True, "MainLegend", "Fuel Types")
End Sub
Aren't you missing a dot between 'it' and the property name? - you have it[NYMarineDiesel] and I believe you should have it.[NYMarineDiesel]"

Related Links

building entity data source control from code behind

Categories

HOME
beautifulsoup
localization
hyperlink
gdb
awk
ng-idle
datastore
youtube-data-api-v3
serialization
fftw
jsf-2.2
database-normalization
aws-cli
pyqt4
settings
discrete-mathematics
extjs4.2
alamofire
intercom
zerobrane
coin3d
database-connection
gulp-watch
named-entity-recognition
joptionpane
game-theory
android-maps
genexus-sd
rpgle
cppreference
uitapgesturerecognizer
calculation
gitlab-api
zend-debugger
github3.py
android-maps-extensions
carriage-return
indy10
lubridate
latitude-longitude
openerp-7
reason
dm-script
mongoose-schema
c9.io
android-checkbox
getchar
tf
spring-data-couchbase
py2neo
gameplay-kit
android-instrumentation
renaming
branch-prediction
donations
taocp
grails-plugin
synonym
installshield-2010
android-dateutils
freepbx
gcloud-ruby
halcon
vhosts
rewrite
wiredep
xvim
cgi-bin
doctype
visual-sourcesafe-2005
dulwich
mirror
typeconverter
kubuntu
mruby
jquery-slider
extjs2
git-repo
xmltodict
bin
gtm-oauth2
windows-phone-8-sdk
workitem
insert-id
intersect
joomla3.1
pstack
paginator
wiimote
convention
google-floodlight
metaweblog
delimited-text
qtabbar
dojo-dnd
perl5.12
fault-tolerance
lemmatization
pbcopy

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App