Below is my code(C#), however nothing is displayed.
The problem seems to be with the @lastlogged parameter as if I hardcode its value are returned, the value lastlogged has already been converted using Convert.ToDateTime(“2012-07-17 15:18:14.993”).
Update Error: Must declare the scalar variable “@lastlogged”.
string sqlStr = "SELECT * FROM View_AllJobDetails WHERE UpdatedDateStaff >= @lastlogged";
SqlCommand cmd = new SqlCommand(sqlStr, cnn);
cmd.Parameters.Add("@lastlogged", SqlDbType.DateTime);
cmd.Parameters["@lastlogged"].Value = lastlogged;
Why don’t you embed the lastlogged value itself into sqlStr –
Another approach could be creating a stored procedure in database and add this parameter.