|
|
thanks
it is so usefull
|
|
|
|
|
In visual c++ the keys ctrl-f2 puts a little blue bookmark next to the current line of code. To return to this code a person just uses the f2 key.
How can I book mark code in the .net editor?
thanks;)
|
|
|
|
|
See Tools -> Customize -> Commands -> Edit
SkyWalker
|
|
|
|
|
|
Ctrl+K. BTW - this is not the right forum for this question. This should have been asked in the Visual Studio forum.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi All
I'm new to C# multithreading and timers.
I've got the code below where I want to prevent the time from repeting itself when the argument passed is not of the string type.
If I uncomment Thread.Sleep(Timeout.Infinite) doesn't work and keeps writing to the console each second when I expected to be stopped.
Why it happens?
Do I have to call tmr.Change(Timeout.Infinit,0) from TimerMethod? This way tmr variable should be shared between the main thread and the thread for the timer and syncrhonization/locking should be involved. Does exist some function to call from TimerMethod from stop itself without referring the Timer object tmr?
Regards
manuStone
class TestTimers
{
public static void TimerMethod(object obj){
if (obj is string) {
String str = (String)obj;
Console.WriteLine(String.Format("Timer by at {0:N6} by {1}", _tmr_cnt, str));
Interlocked.Increment(ref _tmr_cnt);
}
else {
Console.WriteLine("Passed Wrong Argument");
//How to stop the timer here?
//Thread.Sleep(Timeout.Infinite); Doesn't work:why?
//Do I have to call tmr.Change(Timeout.Infinit,0) here?
}
}
public void CallToThread(){
tmr_clbck = new TimerCallback( ThreadFoos.TimerMethod );
tmr = new Timer(tmr_clbck, 5, 0, 1000);
}
private Timer tmr = null;
private TimerCallback tmr_clbck = null;
}
|
|
|
|
|
|
Thanks
I will start digging on it.
Regards
ManuStone
|
|
|
|
|
Hello.
I have an oracle connection and I'm trying to run a stored procedure.
The code for defining the parameters in C# is:
------------------------------
cmd.commandType = CommandType.storedProcedure;
//Parameter 1:
OracleParameter prm1 = new OracleParameter("c1",OracleDbType.VARCHAR2);
prm1.Direction = ParameterDirection.Output;
prm1.Value = '1';
cmd.Parameters.add(prm1);
//Parameter 2:
OracleParameter prm2 = new OracleParameter("c2",OracleDbType.VARCHAR2, 200);
prm1.Direction = ParameterDirection.Output;
cmd.Parameters.add(prm2);
cmd.ExecutenonQuery();
--------------------------------------
The stored Procedure in Oracle (10g) is:
create or replace procedure test (c1 in varchar2, c2 out varchar2) is
Begin
c2:='1';
End test
\
--------------------------------------
The error I'm having is:
"ORA-06502: numeric or value error:charecter string buffer is too small"
I saw that error in few sites but not something like my problem?
Any idea?
Thanks.
|
|
|
|
|
You have there:
prm1 = new OracleParameter("c1",OracleDbType.VARCHAR2)
Therefore, the default length is 256 (i think).
In prm2 = new OracleParameter("c2",OracleDbType.VARCHAR2, 200) you specify a length of 200.
Sometimes, 200 < 256
SkyWalker
|
|
|
|
|
Hi.
Thanks but thats not the problem.
I tried with size 200/256/300/100/500/10 and nothing worked.
I'm with VS2005 and I added refference to the ODP dll of oracle.
What I did manage to do is to give the parameter a value:
prm3.value ='1'
and it worked but when i gave him string.Empty or didn't give him a value (since i want him to get the value from the SP) i got the same error.
Any idea?
|
|
|
|
|
Hi,
first, in your code snippet you set parameter c1 to direction output, whereas in the sp you declared it as input. maybe that's one part of the problem.
Second, Oracle behaves ... let's say different An empty string is the same as NULL in Oracle.
Martin
|
|
|
|
|
Hi martin and thanks for the reply.
Sadly it didn't helped
I tried use: pram3.value = null
but i got the same error.
Only if i give it a string (like: pram3.value = "str") it return the string.
can it be that the SP doesn't return a value and that way it fall?
It looks like a very simple SP.
(b.t.w The direction in my code is input for c1, I typed it wromg in here so that ok).
Do you any more ideas or a simple code for the SP and C# i can see.
I didn't find any oracle+c# on the net
Thank again.
|
|
|
|
|
Ok, next try I recognized that you are using ExecuteNonQuery. Maybe one of the other Executexxx methods will help. If not, I will try it here on our Oracle 9.0.2.
I must confess I never worked with the Oracle provider from Microsoft long. Better use Oracle's ODP.NET.
Martin
|
|
|
|
|
Arrr, It didn't do the trick.
I tried using executescaler instead and got the some error.
Also, I'm working with the ODP (I added the refference and the "using oracle.dataAccess.client") and with oracle 10g.
The problem is that I'm not even sure if the problem is from my C# code or from the oracle.
I know less about oracle so i took a very simple SP So there won't be any problem with that.
If You'll manage to get a result from a SP to a C# code I promise to add you to my holiday gift list 
|
|
|
|
|
Ok, I tried it with this code and it worked here (ODP.NET 10.2, Oracle 9g):
<br />
using ( OracleConnection conn = new OracleConnection( connString ) )<br />
{<br />
conn.Open();<br />
<br />
OracleCommand cmd = conn.CreateCommand();<br />
cmd.CommandType = CommandType.StoredProcedure;<br />
cmd.CommandText = "TEST";<br />
<br />
OracleParameter parm1 = cmd.CreateParameter();<br />
parm1.Direction = ParameterDirection.Input;<br />
parm1.OracleDbType = OracleDbType.Varchar2;<br />
parm1.ParameterName = "C1";<br />
parm1.Size = 200;<br />
cmd.Parameters.Add( parm1 );<br />
<br />
OracleParameter parm2 = cmd.CreateParameter();<br />
parm2.Direction = ParameterDirection.Output;<br />
parm2.OracleDbType = OracleDbType.Varchar2;<br />
parm2.ParameterName = "C2";<br />
parm2.Size = 200;<br />
cmd.Parameters.Add( parm2 );<br />
<br />
cmd.ExecuteNonQuery();<br />
Console.WriteLine( parm2.Value );<br />
}<br />
HTH,
Martin
|
|
|
|
|
Hi Martin ,
Thanks. That help!
I still didn't compere between my code and your but I just run yours and it WORKED!
The only diffrent I saw in a quick glance was that I didn't use the
"OracleCommand cmd = conn.CreateCommand();"
but instead I use
"OracleCommand cmd = new OracleCommand("TEST", conn);"
Thats the only thing that i saw.
Any way, The importent thing is That your code work and now i can try it!
Thanks a lot for your patient and help
Regards,
Roy,
|
|
|
|
|
I found a difference, the Size property for the first (unused) parameter. I bet this is the point.
Glad I could help you.
Martin
|
|
|
|
|
Hello Friends,
I am new in this .Net environment. Can any one give me details of
where can i get all the overview of project shown in the new project dialog
box of .Net.
Take a ex. C# Projects(windows appl., class library). I know these.
but what are others details of each one. specially of VC++.Net.
If any one can give link which give all these basic infomation, it will
be great.
Thanks in Advance.
Rahul Kulkarni.
|
|
|
|
|
One choice would be this[^]
SkyWalker
|
|
|
|
|
Someone you would know to indicate an elegant way to develop an application chronometer?
Thanks .. 
|
|
|
|
|
Perhaps this[^] comparison of .NET timers will help?
/ravi
|
|
|
|
|
Thanks. Naturally I can manage also the millesimi, just?
|
|
|
|
|
Hi,
I have a class called WriteToDoc.
And i made an object of it like this:
WriteToDoc writeToDoc = new WriteToDoc();
I was wondering how can i dispose the writeToDoc object?
Thanks in advance!
|
|
|
|