How to make sure a field is retrieved from a view

How to make sure a field is retrieved from a view

Postby GlennBA » Tue 16 Jun 2009 13:59

Hello

On the server we have a stored procedure for update like this

SELECT ID
INTO v_id
FROM am_kurvereg.kurvereg
WHERE
ID = pi_id
AND edit_date = pi_edit_date;
UPDATE am_kurvereg.kurvereg
SET strkafs = pi_strkafs
WHERE ID = pi_id;
EXCEPTION
WHEN NO_DATA_FOUND THEN RAISE am_def.pkg_fejl.err_dirty;

This is the scheme we are using for Optimistic update.
The edit_date field is updated by a trigger.

In DotNet the first edit goes fine, but when I refresh the grid or call select again, the edit_date field is not retrieved.

Is there any way to make sure that a field is always retrieved - bypassing the cache ?



Best regards
Glenn
GlennBA
 
Posts: 21
Joined: Tue 02 Jun 2009 12:58

Postby GlennBA » Tue 16 Jun 2009 16:19

Column attribute: UpdateCheck.Always do not work.
Can it be something about the transaction not being refreshed ?
GlennBA
 
Posts: 21
Joined: Tue 02 Jun 2009 12:58

Postby GlennBA » Wed 17 Jun 2009 08:01

Adding the following column attributes on edit_date

Column Attribute IsVersion=true
Column Attribute IsDbGenerate=true

makes no difference

What else can I do ?
GlennBA
 
Posts: 21
Joined: Tue 02 Jun 2009 12:58

Postby AndreyR » Wed 17 Jun 2009 13:13

In case you use stored procedures for updating an entity these attributes are ignored.
The refresh code should be written in the partial update methods after the update procedure call.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Postby GlennBA » Wed 17 Jun 2009 14:51

Thanks, that's what I thought.
Do you have a short example for refresh code ?
Or somewhere I can have a look, perhaps?

Best regards
Glenn
GlennBA
 
Posts: 21
Joined: Tue 02 Jun 2009 12:58

Postby GlennBA » Thu 18 Jun 2009 09:04

Hi!

In the DataContext file that is created from a view the only partial method that is predefined is OnCreated.

Further down there is a

private void UpdateVcompany(Vcompany obj)
{
this.Updatecompany((System.Nullable)obj.Companyid, obj.Companyname, (System.Nullable)obj.Primarycontact, obj.Web, obj.Email, obj.Addresstitle, obj.Address, obj.City, obj.Region, obj.Postalcode, obj.Country, obj.Phone, obj.Fax, (System.Nullable)obj.Editeddate);
}


So if I try to create one I get the following compile-time error:

"Type 'GnbaContext.GnbaDataContext' already defines a member called 'UpdateVcompany' with the same parameter types"

A work-around would be to inject some code in

private void UpdateVcompany(Vcompany obj)

to refresh the edited_date (and other fields) after the call to UpdateVCompany.

I just do not know what to write ?

Best regards
Glenn
GlennBA
 
Posts: 21
Joined: Tue 02 Jun 2009 12:58

Postby AndreyR » Thu 18 Jun 2009 09:05

We have sent you the example by e-mail.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Postby GlennBA » Thu 18 Jun 2009 09:07

Thanx
GlennBA
 
Posts: 21
Joined: Tue 02 Jun 2009 12:58


Return to dotConnect for Oracle