Low cost ecommerce web development India flash website design
Updating Records
If you know how to insert records, then updating them is a breeze. Because
you're already come more than halfway while inserting records!
<HTML>
<HEAD>
<TITLE>Student Records</TITLE>
</HEAD>
<body>
39
<%
Dim DB
Set DB = Server.CreateObject (“ADODB.Connection”)
DB.Mode = adModeReadWrite
DB.Open ("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" +
“C:\Databases\Students.mdb”)
Dim RS
Set RS = Server.CreateObject (“ADODB.Recordset”)
RS.Open “SELECT * FROM Students WHERE FirstName = ‘Manas'”,
DB, adOpenStatic, adLockPessimistic
RS (“Email”) = “mynewemail@manastungare.com”
RS (“DateOfBirth”) = CDate(“
RS.Update
%>
</BODY>
</HTML>
As you can see, everything else remains the same. Firstly, you need just
position the current pointer to the record that you wish to update. Use a proper
SQL statement to achieve this. (It is advisable to check if that record exists,
prior to modifying it.)
Then, as earlier, modify the records by assigning new values to them. You
need not assign values to all fields; just modify the fields you need. Then
execute the RS.Update statement to write the changes back to the database.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73