I have a two page website - one page shows a list of documents, the other to edit the properties of that document.
Now if I edit the properties of a document, save the changes I can see the data is changed in the database. But when I reload the list of documents - the list includes the old data. Hit refresh and the modified data is displayed.
If I trace through the changes it really looks like the old data is being returned.
I have tried passing the number of ticks in the URL to make IE load a new version - but it still shows the old version of the data. Even if I refresh the page and it changes - show the same documents details and the old version of the data is shown, again refresh and it is updated.
I have checked the data is being changed in the underlying database.
So taking the following call
using (nhs_patient_document_s documents = new nhs_patient_document_s(Properties.Settings.Default.DataConnectionEDM))
{
List<nhs_patient_document> found = documents.Select<nhs_patient_document>("nhs_patdoc_patientid", String.IsNullOrEmpty(criteria) ? String.Empty : criteria);
output = JsonConvert.SerializeObject(found);
}
Ultimately this is the code which executes the query
public List<T> Select<T>(String Field, String Value)
{
List<T> results = null;
String sql = String.Empty;
try
{
sql = (String.Format("select * From {0} Where {1} = '{2}'", TableName, Field, Value.Replace("'", "''")));
results = Execute<T>(sql, CommandType.Text);
}
catch (System.Exception e)
{
throw e;
}
finally
{
sql = String.Empty;
}
return results;
}
The execute function called above is as follows;
protected List<T> Execute<T>(String CommandString, CommandType CommandType)
{
DataSet dataSet = null;
SqlConnection connection = null;
SqlCommand command = null;
SqlDataAdapter dataAdapter = null;
List<T> results = null;
try
{
connection = new SqlConnection(connectionString);
command = new SqlCommand(CommandString, connection);
command.CommandType = CommandType;
command.CommandTimeout = 0;
if (connection.State != ConnectionState.Open) connection.Open();
dataSet = new DataSet();
dataAdapter = new SqlDataAdapter(command);
dataAdapter.Fill(dataSet);
results = ExtractData<T>(dataSet);
}
catch ( System.Exception e)
{
throw e;
}
return results;
}
Any ideas how I can force it to get new data from the server.
PS Thanks for the suggestions of other frameworks but I only had a very short time to write this and no time to learn them.