|
Hi,
1.
most if not all debuggers, when they stop one thread (e.g. due to a breakpoint) also stop all the other threads in that process; otherwise you would be looking at a moving target, with other threads continuously changing some of the data, making it almost impossible to understand what is going on.
2.
if your "other thread" is not related to anything in the GUI, all is fine. Both will be able to run concurrently, which means Windows will switch from one to the other at any time (and actually can execute both in parallel on a multi-core CPU).
if your other thread wants to touch GUI Controls, you need to use Invoke, see here[^].
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Hi Luc,
Thanks for your reply, it made some sense in my messed up mind.
the main thread and the other thread only share a Queue<datetime> one is a producer and the other is a consumer.
but i was worried that while the latter is running the main will stop like he did in the breakpoint. (using eclipse to debug a web application over tomcat using Java did not result the same when stopping one thread.)
thanks for the help,
Tomer.
|
|
|
|
|
you're welcome.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Dear Mr. Tomer,
Like Mr. Luc said, the threads will act as expected when running. If you would like the other threads to keep going while you are debugging (stopping and going) on another thread, I think you can change this in
Tools > Options > Debugging > `Break all processes when one process breaks' You should check that list of options anyway to check out some cool options. Good luck!
In Christ,
Aaron Laws
http://ProCure.com
|
|
|
|
|
Hi,
I have an application in C#.Net.
This application uses a DSO ActiveX Framer control to load the MS Office applications.
I am loading an excel document here.The loading of the excel comes with default 3 sheets.
I enter some data in Sheet1.
And now i got to the Sheet2 and right click on the tab and click 'Insert' and insert a chart.
Now after selecting the option 'Select Data' from sheet2, i click on Sheet1 to select the Chart data range for the box 'Select Data Source'.
Now when i click on the Sheet1, my application hangs and in order to proceed i have to kill my application from the Task manager.
This does not happen with MSOffice 2003 but only with Office 2007.
My application does not directly get any click events of the Excel. There is a timer and we get this timer tick event.
Could any one help me out in this?
|
|
|
|
|
Hi,
Can any one help to develop a method in C#, so that i can use that statement to INSERT - UPDATE - DELETE operations upon Database.
I'd achieved this in JAVA but couldn't C#
|
|
|
|
|
.Net provides namespaces like System.Data.OleDb and System.Data.SqlClient . These have a lot classes that will help doing these operations. Look into them. If you get stuck somewhere while trying, post the query. There are plenty of members here to help.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Try the following...
<pre> public int ExecuteNonQuery(string strConnectionString
, string strStoredProcedure
, SqlParameter[] ObjSQLParameter)
{
// declare variables
SqlConnection ObjSqlConnection;
SqlCommand ObjSqlCommand;
int intRowsAffected = -1;
try
{
// prepare a connection
ObjSqlConnection = new SqlConnection(strConnectionString);
// open connection
ObjSqlConnection.Open();
// prepare command
ObjSqlCommand = new SqlCommand(strStoredProcedure, ObjSqlConnection);
ObjSqlCommand.CommandType = CommandType.StoredProcedure;
// asign parameters to command
//SqlParameter collObj ;
foreach (SqlParameter collObj in ObjSQLParameter)
{
ObjSqlCommand.Parameters.Add(collObj);
}
// execute command
intRowsAffected = ObjSqlCommand.ExecuteNonQuery();
}
catch ()
{
intRowsAffected = 0;
}
finally
{
ObjSqlCommand.Dispose();
ObjSqlConnection.Close();
ObjSqlConnection.Dispose();
}
// return affected rows
return intRowsAffected;
}
</pre>
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
Ew:
catch ()
{
intRowsAffected = 0;
}
is a very bad idea; just allow the Exception to be thrown.
And why not use using statements for the command and connection?
|
|
|
|
|
I agree...it's happened due to modifying the code snippets.. Thanks
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
|
Hi,
I have an app that gets data out of the database. This data is updated via a separate application. At the moment the first application has to check every x seconds if there is any new data. I seem to remember reading a while ago something about subscribing to data changes or something so that instead of it being a pull from sql server, sql server actually notifies the app that there is new data and then the app can go get it, and therefore doesn't have to check itself.
Is that right, or did I dream that?
Cheers,
Rob
|
|
|
|
|
I guess you are looking for SqlDependency or SqlNotificationRequest class.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Ahhh, that may well be it, thank you very much!
|
|
|
|
|
I agree...But i think using a trigger would be a good idea to keep track any alternation / insertion of data.
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
And how would that send notification to front end?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
so many ways you can do this... But I think your suggestion is excellent regarding this issue.
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
i want to read text of buttons or lables of swf
which is running inside the shockwaveflash control.
Thanks,
zahid
|
|
|
|
|
|
|
With code.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Suppose I have a byte from USB device which holds the day of the week (1 to 7)
I need to print out Sunday to Saturday based on values 1 to 7. I MCU I create a look up table of strings or string array in ROM and access with index.
What is the method here. I think it is enum. But from tutorials I cant figure out how to get a string from a number like indexing.
Please suggest best way here.
Thanks
With Regards
Roy Thomas
"..this file is known as source file probably because it is a source of frustration and anxiety!" - Chuck Sphar - In book 'C# 2005 for Dummies'.
|
|
|
|
|
Hi,
yes enum is fine since the strings you want are valid identifiers, hence:
enum Days {
Monday=1,
Tuesday=2,
...
}
public void Test() {
for (int i=1; i<8; i++) Console.WriteLine(((Days)i).ToString());
}
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
There are several ways (here are two):
string[] weekdays = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
...
string day = weekdays[3]; or
enum Weekday
{
Sunday = 0,
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday
};
...
string day = ((Weekday) 3).ToString();
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Thanks a lot to all.
I got it. One clarification.
string[] weekdays = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
...
string day = weekdays[3];
If I use this method, is it creating a RAM string array? or is this array in ROM only? unlike a variable string?
I am using enum .
Thanks a lot
With Regards
Roy Thomas
"..this file is known as source file probably because it is a source of frustration and anxiety!" - Chuck Sphar - In book 'C# 2005 for Dummies'.
|
|
|
|