V
vidar
We're having some problems with our 3-tier application. On one ASP.Net
page, we're reading data from one database, and inserts the data into
another database. After the insert statement has run, we select the
same data, and create and object that is used in the business layer.
If we use the same connection object for both the insert and select, it
works. But if we use seperate connections, it always fail, but it never
fails on the same record.
It isn't timing out as it only takes 2-4 seconds before it fails. If it
fails, and we execute the same SQL manually a few seconds later, it
works. It seems like the data isn't written to the database straight
away.
Any clues what might cause this?
The select that fails:
using(OleDbDataReader dr = new OleDbCommand(sql.ToString(),
cn).ExecuteReader()) {
if(dr.Read()) {
row = buildDataValues(dr, dataValueDefData);
} else {
throw new MissingFieldException("Missing data. ");
}
}
page, we're reading data from one database, and inserts the data into
another database. After the insert statement has run, we select the
same data, and create and object that is used in the business layer.
If we use the same connection object for both the insert and select, it
works. But if we use seperate connections, it always fail, but it never
fails on the same record.
It isn't timing out as it only takes 2-4 seconds before it fails. If it
fails, and we execute the same SQL manually a few seconds later, it
works. It seems like the data isn't written to the database straight
away.
Any clues what might cause this?
The select that fails:
using(OleDbDataReader dr = new OleDbCommand(sql.ToString(),
cn).ExecuteReader()) {
if(dr.Read()) {
row = buildDataValues(dr, dataValueDefData);
} else {
throw new MissingFieldException("Missing data. ");
}
}