|
the right use of XmlSerializerNamespaces is
XmlSerializerNamespaces namespaces = new XmlSerializerNamespaces();
namespaces.Add("ct", "http://www.swissdec.ch/schema/sd/20051002/SalaryDeclarationContainer");
namespaces.Add("sd", "http://www.swissdec.ch/schema/sd/20051002/SalaryDeclaration");
namespaces.Add("xsi", "http://www.w3.org/2001/XMLSchema-instance");
System.IO.File.Delete(pPathToGenerate);
fs = new System.IO.FileStream(pPathToGenerate, System.IO.FileMode.Create);
writer = new System.Xml.Serialization.XmlSerializer(typeof(XmlSerializatorItems.DeclareSalary));
writer.Serialize(fs, oDeclare, namespaces);
fs.Close();
In the object to serialize you have to specify the namespace for each field.
Life is not short... the problem is only how you organize yourself
|
|
|
|
|
Hi all,
Am trying to call a simple function held against an Oracle database. I've included the function at the bottom of this post. All it does is return a varchar(3) value along the lines of 'ROW' or 'ENG', depending on what value was passed in so one IN parameter and one OUT.
The C# code used to call this is as follows:
OracleCommand cmd = new OracleCommand("SMD2EUP.get_lan_id", con);
cmd.CommandType = CommandType.StoredProcedure;
OracleParameter cv_Ref = new OracleParameter("cv_ref", OracleType.Number, 5);
cv_Ref.Value = item.CV.Ref;
cv_Ref.Direction = ParameterDirection.Input;
OracleParameter lan_ID = new OracleParameter("this_lan_id", OracleType.VarChar, 3);
lan_ID.Direction = ParameterDirection.Output;
cmd.Parameters.Add(cv_Ref);
cmd.Parameters.Add(lan_ID);
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
string result = cmd.Parameters["this_lan_id"].Value.ToString();
The SMD2eup is the name of the package that the function is stored in and get_lan_id is the name of the function. All code compiles successfully. When I run the application I get ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'GET_LAN_ID'
What am I missing as I can't see anything wrong with the code, 1 IN paramter of type Number (or int) and 1 OUT parameter of type VARCHAR(3) (or string) with the directions being declared.
Please can some one help?
Thanks very much...
FUNCTION get_lan_id(cv_ref eup_comm_veh.xvol_region_ref%TYPE) RETURN eup_comm_veh.lan_id%TYPE
IS
this_lan_id eup_comm_veh.lan_id%TYPE;
BEGIN
SELECT lan_id
INTO this_lan_id
FROM eup_comm_veh
WHERE cvh_id IN (SELECT MIN(cvh_id)
FROM eup_comm_veh
WHERE xvol_region_ref = cv_ref);
RETURN(this_lan_id);
EXCEPTION
WHEN NO_DATA_FOUND THEN
this_lan_id := LAN_ERROR;
RETURN(this_lan_id);
WHEN OTHERS THEN
this_lan_id := LAN_ERROR;
RETURN(this_lan_id);
END get_lan_id;
|
|
|
|
|
Try changing the direction of the output parameter to Return.
|
|
|
|
|
Hello,
I am developing an application by using c# that sends SMS messages? But I don't know from where can I start? I have no expereince in doing that.
Thanks.
Dad
|
|
|
|
|
To send an SMS you need hardware or you need someone with the hardware to do it for you. I'm assuming you've not got the hardware, so you need to find someone on-line to do it for you.
They will provide an API, usually in the form of a web service that you can call to send the SMS.
(Don't expect this for free, I suspect most carriers will charge for this service).
Simon
|
|
|
|
|
Getting the hardware is pretty easy - all one needs a mobile and a way to connect it to the computer (cable, IrDA, Bluetooth). Then it's only a matter of working out how to connect to the phone and make it send an SMS.
|
|
|
|
|
|
I want to delete the last index array value?
it is possible or not?
for example
t is an PointF array. it contains 5 values
but i need only 4 values for calculation.
how to delete the last index value?
PointF[] t = {{120,200},{300,400},{500,550},{890,900},{900,900}};
i need only t[] = {{120,200},{300,400},{500,550},{890,900}}
|
|
|
|
|
You can't resize an array. Copy the needed contents from this array to a new one.
|
|
|
|
|
Just loop through the first 4 indexes...and use them for calculations..
ok..
"Programming is a fun"
|
|
|
|
|
You can't delete values from arrays, the only way is to recreate the array 1 size smaller and copy the values you want to keep. (Or just set the values you don't want to 0 or null and ignore them when you process the array).
Best thing to do is use a generic collection. collections can be resized by calling add/delete.
try:
List<PointF> t = new List<PointF>();
Simon
|
|
|
|
|
Hi can any body give some idea on that how string.Empty is different with "" ?
e.g
string S1=string.Empty<br />
string S2="";
Please dont give me any Google Link I have alerdy search . i need a proper answer.
Thanks in advance !!!!!
|
|
|
|
|
|
i disagree...
With greate code, comes greate complexity, so keep it simple stupid...
|
|
|
|
|
Paw Jershauge wrote: i disagree...
I am sorry, but why ?
"Empty" is a static readonly field which will be assigned to "" in the static constructor. So both are same. Only difference I can see is, string.Empty will have only a single instance.
|
|
|
|
|
Assigning multiple strings to "" will also create only one object - the compiler will intern constant strings automatically.
|
|
|
|
|
string can have the value of null, Empty or "". Empty and null = no memory usage, i far as i know.
use this method to check the string: String.IsNullOrEmpty
Heres what they wrote on http://blogs.msdn.com/brada/archive/2003/04/22/49997.aspx[^]
Brad Abrams wrote: As David implies, there difference between String.Empty and “” are pretty small, but there is a difference. “” actually creates an object, it will likely be pulled out of the string intern pool, but still… while String.Empty creates no object… so if you are really looking for ultimately in memory efficiency, I suggest String.Empty. However, you should keep in mind the difference is so trival you will like never see it in your code…
As for System.String.Empty or string.Empty or String.Empty… my care level is low
And by the way, please DO use google because they have the answer http://www.google.com[^]
Please read the first posting by Chris Maunder in this Forum http://www.codeproject.com[^]
With greate code, comes greate complexity, so keep it simple stupid...
modified on Friday, June 27, 2008 6:22 AM
|
|
|
|
|
|
Paw Jershauge wrote: string can have the value of null, Empty or "".
That is not really correct.
The null value is not a string value, it's the string reference that is null.
The Empty value is not a value, it's just a predefined constant that is an empty string ("").
Paw Jershauge wrote: Empty and null = no memory usage
That is not really correct.
As Empty is just a string constant, "" and Empty work exactly the same, and use the same amount of memory. In both cases they are literal strings, so they are predefined in the assembly data, not allocated on the heap.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Guffa wrote: so they are predefined in the assembly data, not allocated on the heap.
I agree with everything you said, except that part. Surely, they must be on the heap? I did some digging around here[^] and found that they are valid heap objects (You can dump contents, track gcroots etc.).
|
|
|
|
|
string.Empty creates a reference to an empty string that already exists. "" creates a new empty string. string.Empty is more efficient.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian Graus wrote: "" creates a new empty string
I think strings are interned. So if there is already some reference to "", it will be reused, I am not sure though.
|
|
|
|
|
Christian Graus wrote: "" creates a new empty string.
No, literal strings are created when the code is compiled, just as the literal string that is the value of string.Empty. They both just copy a reference to an already existing string.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
As the string.Empty property returns a reference to an empty string literal that already exist in the mscorlib assembly, you don't have to create another literal string in your assembly. Other than that there is no difference in the generated code, they both use a literal string that already exists.
The most relevant reason I have found, though, is that the code gets clearer. If you always use string.Empty when you want an empty string, it's obvious what your intention was. If you then see "" in the code you know that the contents of the string was accidentally removed or left out.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Guffa wrote: The most relevant reason I have found, though, is that the code gets clearer. If you always use string.Empty when you want an empty string, it's obvious what your intention was. If you then see "" in the code you know that the contents of the string was accidentally removed or left out.
That's the clearest explanation for it that I've seen in a while.
|
|
|
|