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.



RSS 2.0 feed All content
RSS 2.0 feed ajax
RSS 2.0 feed asp
RSS 2.0 feed aspnet
RSS 2.0 feed bicycle
RSS 2.0 feed copenhagen
RSS 2.0 feed databases
RSS 2.0 feed denmark
RSS 2.0 feed diy
RSS 2.0 feed dotnet
RSS 2.0 feed html
RSS 2.0 feed japan
RSS 2.0 feed javascript
RSS 2.0 feed modding
RSS 2.0 feed photography
RSS 2.0 feed utilities
RSS 2.0 feed vbscript