updating many records in the Table
-
pls guys help,how can I update more than one record in the table,actually I need to update dates,adding 12 months to the dates. eg. data from DB date approved expiry date 2005/05/12 2005/11/12 2005/05/28 2005/11/28 2005/06/28 2005/12/28 so how to I add 12 months to the date approved so as to get the expiry date extended with 12 months. getting something like this: latest data expiry date 2005/05/12 2006/05/12 2005/05/28 2006/05/28 2005/06/28 2006/06/28 pls guys pls I need a C# code to do that.;P
-
pls guys help,how can I update more than one record in the table,actually I need to update dates,adding 12 months to the dates. eg. data from DB date approved expiry date 2005/05/12 2005/11/12 2005/05/28 2005/11/28 2005/06/28 2005/12/28 so how to I add 12 months to the date approved so as to get the expiry date extended with 12 months. getting something like this: latest data expiry date 2005/05/12 2006/05/12 2005/05/28 2006/05/28 2005/06/28 2006/06/28 pls guys pls I need a C# code to do that.;P
minkinin wrote:
pls guys pls I need a C# code to do that
C# code does not alter the database, the best it can do is to forward some SQL code to the database. You need SQL code to solve your problem. The SQL you need is something like this:
UPDATE MyTable SET [expiry date] = dateadd(year, [latest date]);
ColinMackay.net "Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius "If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
-
minkinin wrote:
pls guys pls I need a C# code to do that
C# code does not alter the database, the best it can do is to forward some SQL code to the database. You need SQL code to solve your problem. The SQL you need is something like this:
UPDATE MyTable SET [expiry date] = dateadd(year, [latest date]);
ColinMackay.net "Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius "If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell