Update a record in a database with ASP.NET (C#)

A basic example showing how to execute an SQL statement which does not return a record set in a .Net C# application.

string strConn = @"PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=d:\test.mdb;";
string strSQL = "UPDATE persons SET fullName = 'John Doe' WHERE uID = 6";
OleDbConnection objConnection = new OleDbConnection(strConn);
OleDbCommand objCommand = new OleDbCommand(strSQL,objConnection);

If you get a "Operation must use an updateable query" error message while connecting to a Jet/Access database, you need to adjust the database file permissions: Microsoft knowledgebase Q316675.