|
First, you really should wrap this in a try-catch-finally block, where you commit your transaction in the try, rollback in the catch, and close the connection in the finally.
Without knowing what the data in your DataSet has, you'll need to debug your code and look at the state of the DataSet (perhaps persist it to a file passing XmlWriteMode.DiffGram to easily view the DataRowState ). Make sure that the rows that should be updated have the DataRowState.Modified value.
Since you're merging these updated rows could look like new rows in the target DataSet .
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]
|
|
|
|
|
Is there any possiblities to access all of the variables from a class dynamically (something like MyFriends.GetVariable("Name"); )?
fsadfasdfsadfasdfasdf
|
|
|
|
|
And is there some Information available for Regexps in C#?
I wasn't able to extract strings out of an other string with Regex.Match (e.g. /^([^=]+)=(.+)$/ - should extract key and value of a "key=value" pair...)
(I just edited my account options)
|
|
|
|
|
Here on MSDN[^] are some information about regular expressions.
As for your example, I would use stg like (?<key>.*?)=(?<value>.*)
TyronX wrote:
(I just edited my account options)
best regards,
David 'DNH' Nohejl
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
You can use reflection to enumerate types and their members (properties, fields, and methods). Read Discovering Type Information at Runtime[^] in the .NET Framework SDK.
Note that these aren't "variables". Variables - in practically any language - are temporary memory addresses to store information in a particular function or method (methods are functions declared for a class or other structure). You can also have global variables.
To enumerate properties on a class, for example (since you typically shouldn't expose fields publicly; you have little control over what gets assigned and can't validate the data):
using System;
using System.Reflection;
class Person
{
static void Main()
{
Person p = new Person("Heath", DateTime.Parse("08/07/1978"));
Reflect(p);
}
static void Reflect(Person p)
{
PropertyInfo[] props = p.GetType().GetProperties(
BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (props != null)
{
foreach (PropertyInfo prop in props)
{
object value = prop.GetValue(p, null);
Console.WriteLine("{0} ({1}) = {2}", prop.Name, prop.PropertyType,
value);
}
}
}
Person(string name, DateTime birthday)
{
this.name = name;
this.birthday = birthday;
}
string name;
DateTime birthday;
public string Name
{
get { return name; }
set
{
if (value == null) throw new ArgumentNullException();
name = value;
}
}
public DateTime Birthday
{
get { return birthday; }
set { birthday = value; }
}
}
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]
|
|
|
|
|
I created a Monthly Calendar where each day cell is a Label. I have implemented the Click event to highlight the day and the DoubleClick event to call the day view for the selected day for each label. The problem is that when the DoubleClick event is fired it first goes through the Click event.
How do I distinguish between the two events?
Thanks
|
|
|
|
|
|
the following lines cause a invalid parameter exception in the last line and i'am not sure where my mistake is. Does anybody see the error?
Help is much appreciated.
thank you
Bernd
GraphicsPath gp = new GraphicsPath();
gp =(GraphicsPath)pfadListe[0];
int punktAnz = gp.PointCount;
PointF [] punkte = new PointF[punktAnz];
punkte = gp.PathPoints;
|
|
|
|
|
The first problem (not error) I notice are these two lines:
GraphicsPath gp = new GraphicsPath();
gp =(GraphicsPath)pfadListe[0]; Why are you instantiating the class if you just assign it later (in fact, in the next line)? Either declare (not instantiate) and assign on separate lines, or declare and assign on the same line like so:
GraphicsPath gp = (GraphicsPath)pfadListe[0]; What line does the exception actually get thrown on? Debug your code and be specific. Also, there is no "invalid parameter exception", or even a class called InvalidParameterException . What is the exact type of exception thrown?
My initial guess is that either pfadListe is empty and trying to access the first element via [0] would result in an IndexOutOfRangeException<?code> or that whatever is in the first element of the array cannot be cast to <code>GraphicsPath , in which case an InvalidCastException is thrown.
Please be specific.
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]
|
|
|
|
|
thanks for the tip with the first two lines. i am more a hobby-programmer, i guess.
the exception is thrown in the last line, as i said before.
punkte = gp.PathPoints;
heres the statement i get:
************** Exception Text **************
System.ArgumentException: Invalid parameter used.
at System.Drawing.Drawing2D.GraphicsPath.get_PathPoints()
at DefaultNamespace.MainForm.convToCardSpline(ArrayList pfadListe) in e:\Eigene Dateien\SharpDevelop Projects\CurveGenerator\MainForm.cs:line 174
at DefaultNamespace.MainForm.MenuItem1Click(Object sender, EventArgs e) in e:\Eigene Dateien\SharpDevelop Projects\CurveGenerator\MainForm.cs:line 199
at System.Windows.Forms.MenuItem.OnClick(EventArgs e)
at System.Windows.Forms.MenuItemData.Execute()
at System.Windows.Forms.Command.Invoke()
at System.Windows.Forms.Control.WmCommand(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, I
|
|
|
|
|
You're right, you did say "last line" (I could swear it said "following lines" before).
The exception here is actually ArgumentException and is most likely thrown because whatever your pfadListe contains - or rather how it got filled - does not contain valid data in the PathPoints property. That is, the GraphicsPath either doesn't contain enough data or contains invalid data, so when you try to get PathPoints it's implementation throws an ArgumentException .
There are many reasons this could happen (.NET 1.1 will throw 1 of 21 exceptions based on the error code returned by the native API GdipGetPathPoints ).
Basically, you don't have enough information and need to make sure that the GraphicsPath has enough data to return you the PathPoints .
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]
|
|
|
|
|
first: thanks for your time and helping me.
i appreciate that.
You're right. There is something wrong with tha graphicsPath-Data. I am not sure what this could be.
Is there a problem with storing a GraphicPath-Structure in an ArrayList? Because that is what pfadListe is.
I draw some paths with the mouse on the screen and store them in an ArrayList. Afterwards i wanna do some transformation with the paths.
|
|
|
|
|
I just stored the GraphicsPath-Object in the ArrayList as a reference, what was not clear to me.
so, when i did a reset on the path to store the next drawing-action in it, i also deleted the data in the pfadListe.
shame on me.
|
|
|
|
|
Hello, I have a question. I have a 2D array [372,4], the first bit looks like this:
0.07 0.11 0.21 0.34
1.12 0.77 1.17 1.1
0.24 0.11 0.21 0.37
2.53 2.11 3.24 3.07
0.69 0.49 0.32 0.52
2.04 1.72 2.26 2.01
0.01 0 0 0.06
I would like to add the columns together so I get one single column. If I had a fixed array of the size I mentioned, I would not have a problem, it would look something like:
FD[i]=FD[i,0]+FD[i,1]+FD[i,2]+FD[i,3]
no problem. However, I would like to be able to have a variable for my number of columns, so then my summation would look something like:
FD[i]=FD1[i,0]+FD1[i,1],FD1[i,2]+.....+FD1[i,n-1]+FD1[i,n]
and I am not sure how to or if it is possible to program this. Any clues? Thanks a bunch!!
|
|
|
|
|
Use a list like an ArrayList for each line, then enumerate the list and keep a running sum. How you do that you need to explore, being that this looks like a class problem that you need to figure out and understand.
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]
|
|
|
|
|
Where can I find information on this? This is a project for my job. I am learning to program as I go.
|
|
|
|
|
http://msdn.microsoft.com/netframework[^]. For all SDK documentation go to http://msdn.microsoft.com/library[^]. If you've installed Visual Studio .NET with the default settings, the .NET Framework SDK is also installed and you should have a "Microsoft .NET Framework SDK" program group under Start->Programs which you can read, too.
All you need to do is look-up ArrayList (or IList to see other implementations) and read the documentation. If you're new to programming with .NET, I suggest you pick up a good book that teaches .NET and OO design and browse the Class Library[^] to get a glimpse of all the available classes in the .NET BCL (base class library).
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,
an article from Joel Brandenberger, which discrips how to use simple Remoting, but there are questions ...
first the link to the article:
http://codeproject.com/csharp/RemotingWinApp.asp[^]
he uses 3 projects:
- a Server Application
- a DLL with the Interface declaration
- a Client Application
in this case it works fine but this project is designed for an local or an intranet application...
i need a way to use it at the internet.
i know it would work too, but i have to copy the DLL with the Interface declaration to all Clients.
My ServerApplication should be able to load unknown DLLs and provide them with remoting. So its not user friendly to copy new DLLs to the ClientApplication for every changing on the ServerApplication...
I thought of a possibility to load DLLs over Internet ...?
like
LoadDLL(http://server.tld/Application/AddOns/Interface.dll)
i hope you understand my problem, if not ask ^^
Copyrights © 2003 by Paebbels.net
|
|
|
|
|
i thought over this again and again and i remembered that it was possible in VB 6.0 with COM to set up a ActiveX-DLL-Server this DLL runs on the remote mashine and the cliend had full access to the dll (if i read the book in the right way... Developing COm and AXC with VB 6.0 - Dan Appleman)
but how can i build it in .NET? (VC# .NET or VB .NET)
Copyrights © 2003 by Paebbels.net
|
|
|
|
|
Hey!
I have tryed to find the HttpChannel class by this:
using System.Runtime.Remoting.Channels.Http;
But my Visual Studio 2003 is marking Http. If i Only write :
using System.Runtime.Remoting.Channels.
There will not show some options(like Http).
Is there somthing that i have to make to get this class? i have tryed to write
System.Runtime.Remoting.Channels.http.HttpChannel
but this does not work.
//Jimmy
|
|
|
|
|
Your project must reference the "System.Runtime.Remoting.dll" in order to use this type.
www.troschuetz.de
|
|
|
|
|
Thanks alot, didnt find this in th MSDN but i maby seartch to bad
//Jimmy
|
|
|
|
|
It's quite simple if you know the trick, but it's rarely mentioned. It took me almost a day to find that out
You can find this information at the bottom of each type's MSDN topic.
www.troschuetz.de
|
|
|
|
|
It's no trick, that's just the way it is. Just like in C/C++ you can reference types if you don't include the headers (though that's more analogous to using in C# or import in Java), and you can't link without referencing certain libs. In Java you can't compile without having classes in your class path. In VB you can't use an object if you don't reference the typelib and have the object's class registered on the system. The list of examples go on.
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]
|
|
|
|
|
Yeah, I know it's not really a trick. Maybe this term was a bit inappropriate.
I meant that you have to know how you can reference the libraries and where you can find the information, which library has to be referenced. It's slightly different in each programming language and IDE, so you have to know "the trick" how to do it.
www.troschuetz.de
|
|
|
|