Page 1 of 1

Only getting changed data

Posted: Thu 16 Jul 2009 07:37
by Zero-G.
Hey

Is there a way, how to "only" get changed data from the server?
As an example:

Let's say, I have an central server where all my customers names are stored. - By loading my program, all these customers are loaded into a Grid. - When a a second user on an other PC also loads my program and changes some customers data, then the first one, does not have the correct data anymore, so I want to make a Timer, that the program itself always looks for any kind of changed data and automaticly send to the user.

Hope you understand and can help me, how to realise this with LinQ to SQL

THX

PS: If this will help: I use one column as a timestamp and a trigger, so in the Class the timestamp field is declared as IsVersion.

Posted: Thu 16 Jul 2009 11:54
by AndreyR
Try to use the DataContext.Refresh(RefreshMode.KeepChanges, ) method.

Posted: Sun 30 Aug 2009 09:43
by Zero-G.
Hey

Today I tried your sample with the following code statement:

Code: Select all

LinQProvider.Refresh(Data.Linq.RefreshMode.KeepChanges, LinQProvider.Lieferantens)
There I get an "NotSupportedException" Error with the following StackTrace

bei Devart.Data.Linq.Provider.DataProvider.f()
bei Devart.Data.Linq.DataContext.get_CommandTimeout()
bei Devart.Data.Linq.Mapping.b.Accessor`3.a(T A_0)
bei System.Data.Linq.Mapping.MetaAccessor`2.GetBoxedValue(Object instance)
bei Devart.Data.Linq.MultiKeyManager`2.CreateKeyFromInstance(T obj)
bei Devart.Data.Linq.KeyManager`2.a(Object A_0)
bei Devart.Data.Linq.DataContext.Refresh(RefreshMode mode, Object entity)
bei VOPT.LinqProvider.GetLieferanten(Boolean Enforce)
bei VOPT.ISAuftrag..ctor(Kundenstamm KundenDaten, Auftragstyp Typ)
bei VOPT.usrKundenstamm.cmdBrille_Click(Object sender, CommandEventArgs e)
bei Janus.Windows.Ribbon.CommandBase.OnClick(CommandEventArgs e)
bei Janus.Windows.Ribbon.CommandBase.InvokeOnClick()
bei Janus.Windows.Ribbon.ButtonCommand.InvokeOnClick()
bei Janus.Windows.Ribbon.JNSD.OnMouseUp(MouseEventArgs e)
bei Janus.Windows.Ribbon.JNSAO.OnMouseUp(MouseEventArgs e)
bei Janus.Windows.Ribbon.JNSCE.OnMouseUp(MouseEventArgs e)
bei Janus.Windows.Ribbon.JNSCM.a(MouseEventArgs )
bei Janus.Windows.Ribbon.Ribbon.OnMouseUp(MouseEventArgs e)
bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
bei System.Windows.Forms.Control.WndProc(Message& m)
bei Janus.Windows.Ribbon.Ribbon.WndProc(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
bei System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
bei System.Windows.Forms.Application.Run(Form mainForm)
bei VOPT.VisualOPTNet.Initialize()
bei VOPT.Start.Main()
bei System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bei System.Threading.ThreadHelper.ThreadStart()

Any Tips?

THX

Posted: Tue 01 Sep 2009 12:07
by Shalex
It is necessary to pass IQueriable instead of the DataContext class in .
For example: DataContext.DEPTS or from d in DataContext.DEPTS select d.