|
Hello Everybody !
Does anybody know, why in some articles here, and also in VS.NET -generated Databound form the following logic is used to save DataSet changes to database:
SaveChanges(){
DataSet datasetWithChanges=dataSetUsedByControls.GetChanges();
if (datasetWithChanges != null)
{
SaveChangesToDB(datasetWithChanges); // function where adapters save changes to db.
dataSetUsedByControls.Merge(datasetWithChanges);
dataSetUsedByControls.AcceptChanges();
}
}
I tend to use:
SaveChanges(){
if (dataSetUsedByControls.HasChanges())
{
SaveChangesToDB(dataSetUsedByControls); // function where adapters save changes to db.
dataSetUsedByControls.AcceptChanges();
}
}
So why GetChanges - apply them and then merge with original dataset ? We can simply pass the originald ataset to adapter and changes will also be saved.
Can anyone explain why Microsoft has implemented the first variant it it's data-bound form wizard, and also why some articles use this variant as well ? Where is the trick ?
For example here:
http://www.codeproject.com/csharp/PracticalGuideDataGrids4.asp[^]
-- modified at 6:13 Tuesday 30th August, 2005
|
|
|
|
|
DataSet newbie wrote:
DataSet datasetWithChanges=dataSetUsedByControls.GetChanges();
The dataset "datasetWithChanges" is a new dataset that only has the records from the "dataSetUsedByControls" that actually has changes. Therefore you when the execute the
SaveChangesToDB(datasetWithChanges); //Notice it is the smaller dataset being sent
less network traffic is generated and therefore faster performance. Then the datasets are merged. Your way sends the entire ds back including all the records that do not have any changes to them.
hth
Al
|
|
|
|
|
Thanks, and Stop !
We should clear out the configuration where the code works (I had to write it in my first post probably):
If this is a Local Windows Forms application, then dataset and data adapter are on the same machine, so
during SaveChangesToDB(dataSetUsedByControls); //full dataset
dataset is processed locally throught the adapter and adapter applies only changed data to datasource.
If I understand you, you talk about some distributed application, where dataset and dataadapter are separated through some communication channel, right ?
So If I did understand you correctly this means:
1.Use GetChanges-Update-Merge for Distributed applications
2.Use direct Update from Full Dataset in local applications (this will even have some performance gain, because we avoid creation of new dataset and, later, Merge)
right ?
|
|
|
|
|
MSDN states that on the acceptchanges method ALL rows of each table are updated. So in my situation, which you are correct is distributed, I extract a smaller dataset to send to a webservice. The webservice hooks the dataset into the dataadapter and performs the update.
IMHO, on a local app then I would probably find out how much data actually got changed, if a small amount (<20% perhaps) then create a new dataset and only process it. But if a significant amount (>70% ?) then why waste the resources of creating a new dataset, just update with the acceptchanges like you are doing.
Al
|
|
|
|
|
The truth is somewhere near.
Generally I think that .GetChanges has sence for distributed case.
The costs are:
Case with Merge:
GetChanges (full iteration through full Dataset) fi
Update (iteration through subset) si
Merge (iteration through Full Dataset + subset) fi+si
totally fi+si+fi+si=2*fi+2*si
Case with direct update:
Update - full iteration
AcceptChanges - full iteration
totally 2*fi
Also look here:
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemDataDataSetClassMergeTopic2.asp?frame=true[^]
Thanks !
Andrei
|
|
|
|
|
|
Anyway - the initial question is now more or less clear !
Thanks !
|
|
|
|
|
I have created a service but I don't want users that have "local admin" rights can uninstall it.
I deploy this service via MSI Package and GPO, so an entry is added in "add/remove programs".
How can I add a password in the MSI Package which will be asked during the uninstall ?
|
|
|
|
|
You would have to create a custom DLL action that asks for the password during install, which is a process far too complicated to outline on this forum.
A better question would be why you need to address this in the first place? I know I would be pissed if I couold not simply uninstall anything that was installed on a system that I had admin rights to.
|
|
|
|
|
Hello
I'm trying to deplay a .NET assembly to workstations. This .NET assembly should be registered with regasm.exe (for Com Interop) and placed in the GAC. Using gacutil works fine as a developer but whenh users run the command file (containing various copy, regasm and gacutil commands) the permission to install is not enough. Example:
<cut>
gacutil -i VspJKofaxValidationSupport.dll
Microsoft (R) .NET Global Assembly Cache Utility. Version 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
Failure adding assembly to the cache: Access is denied.
What could i do without digging into a completely different way of deploying? Project time is running out
Aad Slingerland
Zevenaar
The Netherlands
|
|
|
|
|
Hello All,
Can anyone tell me how to resize a textbox to fit a given string? The textbox must keep the same width and adjusts its height to properly display whatever text I put in it.
Thanks!
|
|
|
|
|
Ok one other thing...
I'm thinking of doing something similar with the Label Control as well...
|
|
|
|
|
|
|
Found a solution that should work nicely:
http://www.dotnet247.com/247reference/msgs/43/216202.aspx
|
|
|
|
|
Hey folks, i got a problem...
i got a third party app randomly connecting to 200 different servers.
All servers got a fixed IP that i know.
Now i want that app to only connect to a defined server, lets say server 120.
Is there an possibility to redirect all the other server ips to the ip of server 120?
I don't know if the app has to resolve the ip first but it seems so already tried to manipulate the "hosts" file but the app doesn't care...
If you got any idea pleas let me know... even if its as silly as hell
thanks
|
|
|
|
|
Is there any way in visual Studio .Net to Generate Compiled HTML File (CHM) of the Written code ?
|
|
|
|
|
Hi all
I have a customer who wants to implement all the password policy available.
According to microsoft password policy settings, there's only enable or disable.
- English uppercase characters (A through Z)
- English lowercase characters (a through z)
- Base 10 digits (0 through 9)
- Non-alphabetic characters (for example, !, $, #, %)
Is there a guide I can refer to to create a bypass so as to build in all 4 policy settings?
Thanks in advance.
Thomas
|
|
|
|
|
Barm wrote:
Is there a guide I can refer to to create a bypass
The only way to change this is to write your own custom password filter. You can see this[^] for an example.
I have not seen any attempts or articles of other people writing their own password filters.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
tks a lot...
don't think I'm able to do it though... guess I'll have to talk to the client again... maybe other alternatives...
|
|
|
|
|
Hello, is there a way to make a Visual Studio .NET 2003 RichTextBox give spaces the same width as letters? In notepad, or even in word, a space is given the same width as letters, and I thought changing the font would work, but it did not.
|
|
|
|
|
You have to use a monospace font, like Lucida Console or Courier New. There is no other way to do it.
Most of the font you'll see are all variable width, meaning each character has it's own width. For example a lower case "l" is much slimmer than an upper case "W".
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
THANKS!, that worked perfectly
Mike - I love to program!
|
|
|
|
|
I'm trying to create a basic rich text editor using the .NET's new
RichTextBox control. However, it seems to me that the control is
unnecessarily difficult to work with - especially in comparison to the
RichTextBox ActiveX control I used to use in Visual Basic. For example, I've
still not discovered an effective way of making the selected text bold /
italic / underlined. etc.
With Visual Basic you could just set the control's SelBold / SelItalic /
SelUnderline properties to true but with .NET you from to do something along
the lines of:
rtbEditor.SelectionFont = new Font (rtbEditor.SelectionFont, FontStyle.Bold)
Which wouldn't be a problem except that the SelectionFont property is null
if you happen to have more than one font selected.
The only way around this that I can envisage is to looping through all
selected characters and individually change all of their font properties.
Surely there is some way of doing something as simple as changing the Bold
property without having to resort to ugly hacks like that?
|
|
|
|
|
Hi!
You can take a look at this article:
Getting WYSIWYG Print Results from a RTB[^]
Apart from printing you can see how to add new features to the derived RTB like SetSelectionBold() and the like.
Regards,
mav
|
|
|
|