I have a column called pEditDate in the table rc_Pages I need to extract the date for each page so when the users goes to page /example the last edit date shows at the bottom. I try to do is but can't. Using SQL Server Comptact and C#
What have you tried, and what is your table structure ?
var SQLSELECT = "SELECT pEditDate FROM rc_Pages";
var db = Database.Open("razorc");
var data = db.QuerySingle(SQLSELECT, false);
<span style="color: #f00">Last Edit Date: <b>@data.pEditDate</b></span>
This works but it is the same date for every page, someone said I need a WHERE clause so I can get the page id or something but I dont know this, is asp.net webpages. And I do not know what you mean by Table Structure
Yes, if you want the date for the page, you will need to specify the id for that page. So, I hope you have it somewhere available in a variable. If you do, then you can add the WHERE clause to your SQLSELECT string, so it gets the date for that particular page.
Each page does have an id in the column pId however I simply do not know how to say for this page get its date time. I can't figure it out. Look at my website http://www.thecodingguys.net
var pId = Request["pId"];
var db = Database.Open("RazorC");
var SQLSELECT = "SELECT pEditDate FROM rc_Pages WHERE pId=@0";
var data = db.Query(SQLSELECT, pId);
var pEditDate = data.pEditDate;
I got that so far and it says:
CS1061: 'System.Collections.Generic.IEnumerable<dynamic>' does not contain a definition for 'pEditDate' and no extension method 'pEditDate' accepting a first argument of type 'System.Collections.Generic.IEnumerable<dynamic>' could be found (are you missing a using directive or an assembly reference?)