|
After creating your command and before you execute, add your parameters.
OracleParameter opStuName = new OracleParameter(":stuName", OracleType.NVarChar);
opStuName.Value = "Joe Student";
cmd.Parameters.Add(opStuName);
Logifusion[^]
If not entertaining, write your Congressman.
|
|
|
|
|
I am facing a strange problem when I am deserializing the xml and casting to my request object. I am facing this problem on particular situation, the situation is as below
1. I have a client DLL
2. I have a interface DLL
3. I have a core DLL
The call invokes from client to interface from interface to core. In Interface I am using reflection to lookup one of the decision making class in Core DLL. In this situation I am able to send my sample XML from client to the Core DLL there I am desrializing the XML into specific object in that place it is failing.
If I write the same in single file it is working, if I place them into DLL it is not working.
Please try to simulate as i mentioned otherwise it is working.
The following peace of code faling in the core DLL.
public static NoneyaRequest PopulateXmlIntoRequestDTO(string xmlStr)
{
Console.WriteLine("Enetering PopulateXmlIntoRequestDTO:" + xmlStr);
NoneyaRequest userInfo = null;
try
{
XmlSerializer ser = new XmlSerializer(typeof(NoneyaRequest));
//StringReader sr = new StringReader(xmlStr);
XmlDocument xdoc = new XmlDocument();
xdoc.LoadXml(xmlStr);
XmlNodeReader nodeReader1 = new XmlNodeReader(xdoc);
nodeReader1.Read();
//The below line is causing the problem
userInfo = (NoneyaRequest)ser.Deserialize(nodeReader1);
////The above line is causing the problem
Console.WriteLine("LI:" + userInfo.LoginAccountIdentifier);
Console.WriteLine("AId:" + userInfo.ApplicationId);
Console.WriteLine("Opp:" + userInfo.Operation);
}
catch (XmlException e)
{
throw new SecurityException(e.Message);
}
return userInfo;
}
|
|
|
|
|
try to use this:
MemoryStream memoryStream = new MemoryStream(Encoding.ASCII.GetBytes(xmlStr));
XmlSerializer ser = new XmlSerializer(typeof(NoneyaRequest));
NoneyaRequest userInfo = (NoneyaRequest) ser.Deserialize(memoryStream);
// Just do what you want with your object "userInfo"
|
|
|
|
|
|
There is no way from the .NET framework to make a thread sleep for less than a millisecond. You can call Thread.Sleep(0) which will simply cause the process to switch contexts and let another thread run for a moment before returning and processing the current thread.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: And in this corner, the Party of Allah
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
Maybe the StopWatch class can help you.
StopWatch watch = StopWatch.StartNew();
while (watch.ElapsedTicks < someValue)
{
}
somevalue has to be computed from Stopwatch.Frequency to reflect the wanted amount of microseconds. Should be some easy math but I'm too lazy and also want to leave some coding for you
-- modified at 16:26 Monday 14th August, 2006
Just an annotation: This way your thread doesn't really sleep but actively waits for time to go by, so this isn't really good practice and shouldn't be used often.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
It can't be done. The Windows platform doesn't have programmable access to any hardware timers with that kind of resolution.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I was wondering when someone would realise this
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9
Ed
|
|
|
|
|
Thread.Sleep(100). This worked for me before
|
|
|
|
|
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
1 millisecond = 1000 microseconds...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Look at the FrameworkTimer in the DirectX SDK!
/\ |_ E X E GG
|
|
|
|
|
Althought the QueryPerformanceCounter function does have a resolution of 1 microsecond, you cannot sleep a process that accurately. The best your going to do is 1 millisecond, and even then, the resolution can vary by 10-15 milliseconds due to Windows being a shared system.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
This may seem general but it has happened quite a few times in my month of using C# in Visual Studio.
There are cases where it is obvious that an exception should be thrown, but instead, the program just hangs there and does nothing.
Ex. double[] a = new double[table.Count];
if table is null, it should throw a NullReferenceException. Instead, the program stops and appears to wait indefinitely.
If this phenomenon is common then I hope someone can explain it to me. If not, then please tell me if you have no idea what I'm talking about.
Thanks,
Stanislav
|
|
|
|
|
tachobg wrote:
If this phenomenon is common then I hope someone can explain it to me. I
This is not common. Is Visual Studio hanging or your entire program hanging?
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: And in this corner, the Party of Allah
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
No, it's just the program that hangs.
|
|
|
|
|
You could always check to see if the table is null first. Also, is this code inside of a thread or overridden message?
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Yes, you can definitely prevent such exceptions from happening, but when they do happen, they are pretty hard to debug, since it doesn't give you anything to work with -- you don't know the line number or the type of exception.
As for the second question, no it's not.
|
|
|
|
|
What happens when you wrap it in an immediate try catch?
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
It never gets to the catch part...it tries to execute the statement, then it hangs. Really weird.
|
|
|
|
|
What does the following do:
try{
int index = table.Count;
double[] a = new double[index];
}
catch(Exception e1){
...
}
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Now it throws an exception. Though it seems strange that no exception is thrown just because you have an embedded statement instead of an assignment. I will do some testing to see if this happens in general or just in my program.
Thanks to everyone for their help.
|
|
|
|
|
As I expected it does exactly as it should outside the context of my program
|
|
|
|
|
Hi,
I was wondering if I could open a MainMenu menu via code?
.NET 1.1
Thanks,
Ron
-- modified at 14:14 Monday 14th August, 2006
|
|
|
|
|
Hi,
I have a process called from a main application, which invokes another 3rd party excutable program having its own UI. The main application has to wait untill the process finishs. My code is:
<br />
process1.StartInfo.FileName = exeFile;<br />
process1.StartInfo.Arguments = argFile;<br />
process1.Start();<br />
process1.WaitForExit();<br />
I hope the 3rd party program will run as a model dialog, but when it's running, the background main application UI can't be seen. Any way to refresh the main application so that user can see its UI when running 3rd party program?
Thanks.
-- modified at 16:12 Thursday 17th August, 2006
|
|
|
|