Given that query is a valid update statement, the following code executes to completion, no errors. But no changes are made to the db. It fails silently.
cmdSQL.CommandText = query;
Con.Open();
cmdSQL.Transaction = Con.BeginTransaction();
cmdSQL.ExecuteNonQuery(); //returns 1 where expected
cmdSQL.Transaction.Commit();
Con.Close();
so does this:
cmdSQL.CommandText = query;
Con.Open();
cmdSQL.Transaction = Con.BeginTransaction();
SqlDataReader reader;
reader = cmdSQL.ExecuteReader();
int fields = reader.FieldCount;
while (reader.Read())
{
for (int i = 0; i < fields; i++)
details.Add("" + reader[i]);
}
reader.Close();
cmdSQL.Transaction.Commit();
Con.Close();
Here's the connection string:
Data Source=(LocalDB)\\v11.0;AttachDbFilename=|DataDirectory|\\LocalDB.mdf;Integrated Security=True
So the question is: How do I get updates to work?
PS: select statements work fine.
PPS. The database was created through visual studio 2013... It's a service based database
PPPS. I asked this question too... I assume they have a similar answers. Same problem, different approach: TableAdapter.Update returns 1 but no changes in db