|
Hi All,
I've already sent this problem and was replied by some senior software engineer of microsoft but I could not be clarified. Let me elaborate the problem again:
I've populated a dataset object with records from multiple tables by executing a stored procedure(in which I've used the joining of the tables). Then I bound a datagrid with this dataset. When user made the changes, is there any way that these changes can be accomodated in the original database tables(because there are more than one tables hence I feel problem in propagating these changes). Can anyone plz suggest me some solution or the way with which this can be dealt with?
I shall be very thankful
Regards
|
|
|
|
|
The CommandBuilder will not be able to generate the INSERT, DELETE and UPDATE commands of a multiple table query. U will have to do this manually.
The best way is to create parametrized commands:
As an example, imagine we have the following query: "SELECT T1.A,T1.B, T1.C, T2.D FROM T1,T2 WHERE T2.C=T1.C" being T1.A the primary key of table T1.
We create a dataadapter and fill up our DataSet:
myDataAdapter.Fill(myDataSet,"myTable")
For sake of simplicity, let us say that ur datagrid is bound to the table resulting of this query and shows fields A,B, C and D, but only A, B and C can be edited->thus we only have to propagate changes back to table T1. (Propagating to T2 wouldnt be a problem, but lets keep this as short as posible).
We would create our update, delete and insert commands as follows:
INSERT COMMAND: INSERT INTO T1(A,B,C) VALUES(@A,@B,@C)
Parameters would be mapped to DataColumns A,B and C and RowVersion would be Current.
DELETE COMMAND: DELETE FROM T1 WHERE T1.A=@A
Parameter would be mapped to DataColumn A and RowVersion would be Original.
UPDATE COMMAND: UPDATE T1 SET T1.A=@A_current, T1.B=@B, T1.C=@C WHERE T1.A=@A_original
Parameters would be mapped to DataColumns A,B,C and versions would be Current except the primarykey used in the Where statement which sould be Original.
Once created all commands, we would assign them to our dataadapter and to propagate changes back to the database we would execute:
myAdapter.Update(myDataSet,"myTable");
If your datagrid does not contain all the fields of ur table then pass along the default values in ur sql commands (no need of parameters in those cases).
U could also solve the problem using the dataTable.GetChanges([rowVersion]) method and iterating through all the modified rows and executing the necessary NonQueryCommands using the Update/Insert or Delete commands similar to the shown above depending on the RowState of the current row. This would be a better solution when propagating changes back to multiple tables as you would only have to iterate once throug ur modified rows in order to propagate changes to all afected tables (just run all the nonqueries to all the tables u need on each row).
|
|
|
|
|
|
Hi all,
1.I am a Singapore student working on my final year project. I am using DirectSound and C# to acquire .wav sound from a microphone output. But how do I show the waveform while acquiring it?
2. Is there anyone who can advice me on how to do video conferencing in C#? Any resources? I have searched many websites but don't seem to find one which can stream video and audio at the same time?
Many many thanks.
Eng Eng
|
|
|
|
|
Hi,
Basically a Command is nothing else than a Plugin, should mean that i would like to be able to write Commands which implement the ICommand interface and are stored in different assemblies, which are loaded at run time through a type loader.
I have a collection of Command's, let us call it my project file which i serialize trough the SoapFormatter.
So, now we have a project file which holds a command configuration set, now i would like to load this file again (later), but now it happens...
First i run my TypeLoader which loads the needed assemblies into the current AppDomain. Then my code tries to deserialize the soap file, it throws an exception saying that the needed assembly/type is not found, but ermz, my TypeLoader loaded the needed assembly...
Any hints? In my opinion it should work, because all assemblies are loaded during Deserialize, it's the same game like Serialize
myMsg.BehindDaKeys = "Jerry Maguire";
|
|
|
|
|
If I understood correctly, you aren't able to deserialize some previously SoapFormatted objects. Without some code, it's hard for us to guess what's wrong, but the most common serialization problem I see here is versioning, which can be solved by setting the AssemblyFormat property of the SoapFormatter to FormatterAssemblyStyle.Simple before serializing.
Yes, even I am blogging now!
|
|
|
|
|
System.Runtime.Serialization.SerializationException
Additional information: Parse Error, no assembly associated with Xml key a4:http://schemas.microsoft.com/clr/nsassem/Raccoom.Batch.Commands/Raccoom.Batch.Commands BuildCommand
myMsg.BehindDaKeys = "Jerry Maguire";
|
|
|
|
|
Hi Daniel,
I made shure that my assemblies always ware the same version number, no auto increment build numbers.
Now i found out that everything goes well if i copy the needed assembly into my bin directory.
myMsg.BehindDaKeys = "Jerry Maguire";
|
|
|
|
|
Hello,
I created a component with extended property in A WEB FORM! (not windows form).
the data is stored in hashtable.
problem:
the hashtable values are not added to the form after updating the extended property. meaning, in run-time the hashtable is empty.
for unknown reason, in web application, you should do something to make the hashtable values being added to the form.
how to do so?
many thanks,
Eran.
|
|
|
|
|
Hello,
I created a component with extended property in A WEB FORM! (not windows form).
the data is stored in hashtable.
problem:
the hashtable values are not added to the form after updating the extended property. meaning, in run-time the hashtable is empty.
for unknown reason, in web application, you should do something to make the hashtable stored.
how to do so ?
many thanks,
Eran.
i read that
|
|
|
|
|
Hello,
How to create dynamically multiples controls (progressBar) varies on item count of listbox.
Items elements vary.
Thanks
|
|
|
|
|
The same way as you would a static number or as the designer does it (take a look at your code-behind source file sometime for a Form or UserControl :
for (int i=0; i<listBox1.Items.Count; i++)
{
ProgressBar pb = new ProgressBar();
Controls.Add(pb);
}
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hello,
i have a problem, it is a bit long explenation but please help...
this is very very annoying problem.
i created a component the implent the IExtenderProvider.
I have "binding" property which saves information of controls in an HashTable.
since the binding is a class, i use "ExpandableObjectConverter" to convert the value from string to object
When i add the binding propery to a control in a form, it seems to be fine.
BUT when i move to the "cs" file to see how it was added, i get the following error in the "task list" : "code generation for property Binding failed. Error was: 'key cannot be null. Parameter name key'" !?
the cs files remains as is without any modifications.
i tried to debug the design-time and saw that the values are added to my hashtable. offcurs not while run-time (it makes sense since nothing is being added to the cs file).
i don't have such a property named "key"...
Eran Sakal.
code attached :
[Category("Data"), Description("Define DataBinding on object")]
[DefaultValue("")]
public Binding GetBinding(Control extendee)
{
if (m_bindingCol.Contains(extendee.ID))
return (Binding)m_bindingCol[extendee.ID];
else // if not exist, create default value which is not added to the hash table
{
Binding binding = new Binding(null);
return binding;
}
}
public void SetBinding(Control extendee, object value)
{
Binding binding = value as Binding;
binding.Control = extendee;
if (binding.ObjectProperty == null)
m_bindingCol.Remove(extendee.ID);
else
{
// set default controlproperty if null
if (binding.ControlProperty == null)
binding.ControlProperty = (extendee is CheckBox) ? "Checked" : "Text";
if (binding.ObjectType == null)
binding.ObjectType = m_boundType;
// add to collection
if (m_bindingCol.Contains(extendee.ID))
m_bindingCol[extendee.ID] = binding;
else
m_bindingCol.Add(extendee.ID,binding);
}
}
|
|
|
|
|
|
How can I know which of my winforms are open?
Thanx
|
|
|
|
|
Do you want to know which are open or which are active, because there's a difference? Only one top-level window can be activated on the entire desktop at a time. If you want to get the active form in your application, then use the static Form.ActiveForm property.
If you want to know which windows are open, then you need to track your Form variables.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi
Is there a way to find any of the managed directx dlls eg. microsoft.directx.dll if the user doesn't have the directx sdk installed?
Thanks
|
|
|
|
|
|
Basically on computers with directx 9c sdk installed there is a Microsoft.NET/ManagedDirectx directory in the windows directory which contains the directx dlls. Is there any way for users to access these without having the directx sdk installed?
thanks
|
|
|
|
|
thepersonof wrote:
Basically on computers with directx 9c sdk installed there is a Microsoft.NET/ManagedDirectx directory in the windows directory which contains the directx dlls. Is there any way for users to access these without having the directx sdk installed?
What to you mean by "access"?
If the files are on disk then yes, this folder has no special permissions on it.
If you need Managed DirectX to be on the system for your application to run then you need to install the DirectX redistributable with your application. The SDK is a Software Development Kit which has additional aids and documentation for developing software which your end users do not need. If this is what you mean the link I gave in my previous post will help you find the redistributable package.
Does this help?
Do you want to know more?
WDevs.com - Member's Software Directories, Blogs, FTP, Mail and Forums
|
|
|
|
|
my application is to be used for the creation of 3d graphics and also of presentations. Therefore in order to compile these dlls are required. In other forums it has been suggsted that they are in the GAC, would I find them thereor would I have to distribute thm myself?
Thanks
|
|
|
|
|
thepersonof wrote:
Therefore in order to compile these dlls are required.
Compiling the application is something that the developer does. The user does not need to compile the application as they receive it in the compiled state.
The compiled version will need the appropriate assemblies to be available to it. This is why you need to redistribute the Managed DirectX assmeblies as you are not permitted to supply the SDK.
thepersonof wrote:
In other forums it has been suggsted that they are in the GAC, would I find them thereor would I have to distribute thm myself
That is correct. You therefore need to supply the Managed DirectX redistributable with your applicaction. Its installer will make the appropriate checks and install itself if necessary.
Does this help?
Do you want to know more?
WDevs.com - Member's Software Directories, Blogs, FTP, Mail and Forums
|
|
|
|
|
Not really. My program compiles 3d graphics and presentations, that is what the problem is, not redistributables, etc which I am perfectly competent with. Thanks for trying though.
|
|
|
|
|
If you are competant with redistributables, then where is the problem distrubitng the DirectX SDK with your 3d compiler application?
|
|
|
|
|