Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Records Insert But Do Not Update
Message
De
12/06/2005 12:09:27
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
Records Insert But Do Not Update
Divers
Thread ID:
01022594
Message ID:
01022594
Vues:
62
Kevin,

I am using a custom data access class and a typed dataset to retrieve and save-update-delete one of my tables on an AS400 DB2. The OleDbAdapter Wizard generates select and insert commands but does not create update and delete commands because the wizard cannot determine the PK. I also have this problem with Fox databases.

Because I expect to use custom data access classes for all my tables in the future, I wrote a program in Fox to generate the update and delete commands and parameters. Then all I have to do is paste the code into the data access class.

The problem is I don’t have too much info to go on and I am using the insert command code and a SQL update command as examples. I am able to insert a record, but when I try to update the record, fields do not reflect any change.

I wrote the following code to retrieve the record I wanted by its primary key. Then I call the business object’s SaveDataSet method to update the record.

Dim dsTicket As TicketDataset = boTicket.GetJustTicketById(58)
With dsTicket.TICKET(0)
.PRODUCTID = 208
.STATUS = 788
.CGOTHEREXPLANATION = "Explanation"
.AFOTHEREXPLAIN = "Other"
.SAFOTHEREXPLAIN = "Other"
.REPLACAMT = 12555
.PROCESSDATE = #1/1/1999#
End With
Dim result As mmSaveDataResult = boTicket.SaveDataSet(dsTicket)

When I step through the code, I see that the typed dataset has the correct record, and mmBusinessObject is retrieving the correct custom data access class. In the mmBusinessObject code:

// Save the DataSet, and if specified to do so, retrieve any auto-increment PK value
try
{
RecordsUpdated = dao.SaveDataSet(ds, tableName, PK, RetrieveAutoIncrement, dbAdapter);
}

dao is the correct class, all parameters are of the correct value and type except the dbAdapter is undefined. When I step over the code, RecordsUpdated = 1 but when I examine the record later, there are no changes.

I am getting no errors. I drilled through the dao and ds objects after the dao.SaveDataSet call looking for something that would tell me why the record was not updated, but I don’t know enough to see any problems.

I’m sure it is my Update command or parameter generated code. I will be glad to send it if it would help, but it is a lot of code. Could you tell me where I could find some specific update and delete command and parameter code for a DB2 to compare to my generated code.

Thanks in advance for you help.

Bill Williams
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform