For Migrating from Classic ASP to ASP.NET, the following code will
<%@ Page Language="C#" AutoEventWireup="true" <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <html xmlns="http://www.w3.org/1999/xhtml"> ============================= To delete a record. int i =0; foreach (DataRow dr in ds.Tables["table1"].Rows){ i++; if (dr["id"] = = 23 ) break; } table1.Rows[i].Delete; Edit a record: foreach (DataRow dr in ds.Tables["table1"].Rows) if (dr["id"] = = 23 ) dr["name"] = "new name";
Insertion a record DataRow dr = EmployeeData.NewRow(); dr["id"] = "23"; dr["name"] = "raja"; table1.Rows.Add(dr); All the above delete,edit and insert done in DataTable which is nothing but the Memory. We have to write back into the Hard disk database. OracleCommandBuilder cb = new OracleCommandBuilder (da); DataSet newds = ds.GetChanges (DataRowState.Modified); da.Update(newds, "table1");
|