|
niranjanR wrote: But I want to remid you that if you can't answer the question..
Who said I can't answer it ? I suspect no-one can, because you've not posted all the pertinent code, but I have no doubt I could solve the issue if I set myself to doing so, I've done quite a bit of multi threaded code.
niranjanR wrote: nobody is asking you to jot your derogatory comments....
True, I provide that service of my own volition.
niranjanR wrote: You don't know where I am
True, I don't know where you are, niranjan. I think I can guess tho. The questions that start with 'I am new' and go on to some incredibly complex task and show no signs of people having tried to help themselves, tend to all come from the same continent.
niranjanR wrote: what am I doing
You're apparently trying to write multi threaded code despite not even known much C# yet.
niranjanR wrote: so stay outta my business.
Well, don't post here if you don't want me to answer.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
You must be the worst helper...
I posted here seeking some advices nd not insults..... you are not helping in anyway and only trying to frustate and infuriate... so don't reply if you have no answers to the problem raised ..
And for sure.. u r a racist.. u r of no use.. u r urself frustated..
|
|
|
|
|
niranjanR wrote: You must be the worst helper...
Well, to people who are ignorant and unwilling to learn, I probably seem that way.
niranjanR wrote: you are not helping in anyway and only trying to frustate and infuriate...
My aim is always to help. Sometimes the best help I can give is to tell people they are not smart enough or experienced enough for the task at hand. Just because it's not well recieve, doesn't mean it's not good advice. Most people who used to post here a lot, just don't bother anymore, because of people like you.
niranjanR wrote: so don't reply if you have no answers to the problem raised ..
I know the answer, I told you. You don't understand C# enough to be doing multi threading. You have a race condition because your code is not well thought out.
niranjanR wrote: u r a racist..
Not even remotely. I have good indian friends, and I have hired indian programmers many times. The ones I hire, are all in the west. The ones I've hired who were in India, were uniformly useless. And the people who post here asking us to do their work for them, are generally worse than useless. I can't help that. I just tell the truth, but I am certainly not racist.
niranjanR wrote: u r of no use
Not to lazy people, apparently.
niranjanR wrote: . u r urself frustated..
ROTFL !!! Why am I frustrated ? That's just priceless. My life is perfect, I couldn't be happier. The amusement I get out of people who are clueless, ask me for help and then think they can insult me because they don't like the answer, are just the icing on the cake.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
niranjanR wrote: I am very much surprised as well as confused on this issue... I can't resolve it... I thank you in advance for any help.
From the portion of code you have posted it looks to me like it is working as coded. Your program is a set of sequential operations which you try to run in parallel. So sometimes you get the result you expect and sometimes not, depending on which thread gets run first. Your use of threads in this case is superfluous as it does nothing to improve the program.
As Christian said earlier, you would be better to spend more time getting familiar with C# basics before worrying about multi-threading.
|
|
|
|
|
It seems to be a synchronization issue here. When you have the function call there, it slows down each iteration thus resulting in a different execution order of the concurrent calls. The fact that your output is right is coincidental because for a larger array, and on a different machine you may still see the unsorted or wrongly rearranged array.
|
|
|
|
|
Have you considered just using Array.Sort() ? Implementing your own sort is usually a bad idea unless you know what you're doing... Especially if you're locking, unlocking, and redisplaying the whole thing each pass through the loop...
If you want items to show up in sorted order as they're added to the list, then just do that; use an insertion sort or equiv. and let it sort as-needed.
niranjanR wrote: I call showArray(N); before and after the execution of the sorting code.
See, this is what Nish is getting at: if you're running your sort on a background thread, you need some way of communicating your status back to the main thread - otherwise, showArray() will run too early (or too often if you also run it from the worker thread)...
|
|
|
|
|
I have 1 table student(ID,Name,Address).
and i make a stored procedure
<br />
CREATE PROCEDURE [dbo].[Proc_Scenario_GetMaxID]<br />
@MaxID as int OUTPUT<br />
as<br />
BEGIN<br />
if((SELECT MAX(ID) FROM student) is not null)<br />
begin<br />
SET @MaxID = (SELECT MAX(ID) FROM student)<br />
end <br />
else<br />
Begin<br />
SET @MaxID=1<br />
END<br />
return @MaxID<br />
END<br />
so i can't get the MaxID in C#.
Please help me !
sorry for my english.
|
|
|
|
|
Why can't you ? What have you tried ? ExecuteScalar may work, if not, just build a data reader and read your field.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
How to get return value in C# code ?
Thank !
|
|
|
|
|
So, if I get this right, what you're saying is that you don't know anything about C# at all and have done nothing to try to learn it ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Sorry, i have learned C# for 2 weeks
<br />
SqlConnection connect = new SqlConnection(ConnectionFactory.strconn);<br />
connect.Open();<br />
cmd = new SqlCommand("Proc_student_Add", connect);<br />
cmd.CommandType = CommandType.StoredProcedure;<br />
cmd.Parameters.Add(new SqlParameter("MaxID",varScenario.ID));<br />
<br />
With that stored procedured i can't get return value by "int i = cmd.ExecuteNonQuery();", please help me to resolve this problem.
Thank !
|
|
|
|
|
SqlCommand sampleCMD = new SqlCommand("SampleProc", nwindConn);
sampleCMD.CommandType = CommandType.StoredProcedure;
SqlParameter sampParm = sampleCMD.Parameters.Add("RETURN_VALUE", SqlDbType.Int);
sampParm.Direction = ParameterDirection.ReturnValue;
sampParm = sampleCMD.Parameters.Add("@InputParm", SqlDbType.NVarChar, 12);
sampParm.Value = "Sample Value";
sampParm = sampleCMD.Parameters.Add("@OutputParm", SqlDbType.NVarChar, 28);
sampParm.Direction = ParameterDirection.Output;
nwindConn.Open();
SqlDataReader sampReader = sampleCMD.ExecuteReader();
Console.WriteLine("{0}, {1}", sampReader.GetName(0), sampReader.GetName(1));
while (sampReader.Read())
{
Console.WriteLine("{0}, {1}", sampReader.GetInt32(0), sampReader.GetString(1));
}
sampReader.Close();
nwindConn.Close();
Console.WriteLine(" @OutputParm: {0}", sampleCMD.Parameters["@OutputParm"].Value);
Console.WriteLine("RETURN_VALUE: {0}", sampleCMD.Parameters["RETURN_VALUE"].Value);
|
|
|
|
|
That's a whole lot more work than is necessary, but I accept it would work.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Thank you very much
|
|
|
|
|
If you've been learning C# for two weeks, why are you working on calling stored procedures ? There's no way that's a sensible next step for you at this point.
The MSDN site is a good place to look for documentation. You should really also own at least one C# book. Either way, ExecuteNonQuery returns a number that tells you how many rows were changed. The documentation will tell you this. I told you in the first instance that you should call ExecuteScalar, if you had any idea what you were doing, or willingness to do a little research, you should have been able to work that out. Even the intellisense would show you the answer.
If you're doing a course, you should talk to your teacher about getting some resources to help you do some basic research. If, as I expect, you're doing paid work, then you're yet another example of the disgraceful excuse for an industry that has popped up in the third world, where people with no experience work on paid systems and then expect the people in the West who lose their jobs to you, to do the work for you. There is no level on which someone who started to learn C# two weeks ago, should be working on this sort of code, unless they have sufficient experience in another language to be able to do some basic research for themselves and to understand a post like my initial reply.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
|
Get the value that returned
Thank !
|
|
|
|
|
|
CREATE PROCEDURE [dbo].[Proc_Scenario_GetMaxID]
(
@MaxID int OUTPUT
)
as
if exists(SELECT [ID] FROM student)
SELECT @MaxID = MAX(ID) FROM student
else
SET @MaxID=1
----------------------------
Because '@MaxID' is OUTPUT
So Your stored procedure...
----------------------------
Chinese programmers: 狼人软件
|
|
|
|
|
REATE PROCEDURE Proc_Scenario_GetMaxID
@MaxID int OUTPUT
as
BEGIN
if((SELECT MAX(ID) FROM student) is not null)
begin
SET @MaxID = (SELECT MAX(ID) FROM student)
return 0
end
else
Begin
SET @MaxID=1
return 1
END
end
code for execution :--
declare @i int
exec Proc_Scenario_GetMaxID @i output
print convert(char(4),@i))
|
|
|
|
|
Hello,
I want to create a simple alternative of PowerPoint slides.
I'll try to explain what I want to program.
I want a form that displays some slides which the contents are stored in the database. This can be a simple text, image or a video. I also want to have a kind of Marquee on bottom of the form. I thought about using DirectX for smooth Marquee, but don't know if that will be the best option. So I want to ask you guys what I better can use.
Greetings,
Abadi
|
|
|
|
|
I'm not saying that what I am going to suggest is 'better' than DirectX, in terms of smoothness and control DirectX will probably be 'better'.
If you go to the Code Project Home Page and type c# marquee into the search box at the top you will find several 'marquee' controls. Have a look at the code they contain and see if you can use it.
Also on MSDN there is an example Walkthrough: Creating a Windows Forms Control That Takes Advantage of Visual Studio Design-Time Features [^] that includes a marquee control.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
|
Check the value of xcontrol. If it's never anything other than 0 or 1, then you'll keep calling Lhesaplax and never hit your base case to exit the recursion.
Dybs
The shout of progress is not "Eureka!" it's "Strange... that's not what i expected". - peterchen
|
|
|
|
|
Don't delete your message - how rude, after you got the help you needed.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|