Here is the situation:
I have a webform that needs to read specific fields from a database that uses the eval function in the .aspx page. I know how to assign the values in the .aspx page, but in the code behind how do I “get” the values and bind them to the .aspx page? Can I just used a datareader? Dataset? What exactly am I going to be binding or reading to the dataset or reader? Do I need to create a method?
I already have the stored procedure created to pull the data from the database. I was going to create a method with the stored procedure. I just dont which kind to create…dataset, datareader? And how do I code it in the code behind?
Declare public properties for your DB fields:
Now you can either just assign them in the aspx page like <%=MyFieldID%> or use them in the code behind.