|
Hello Dmitry,
First of all thanks a lot for your quick reply
this work around works great and the value is storing and retreiving properly but now the problem is I cant query the the 'value' field of 'tt' table
select * from tt where value = 18446744073709551614
this does not work
can you please help me.
thanks a lot again for your helpabhinav
|
|
|
|
|
Yeah, you should always pass ulong value as parameter, not as a string inside a query:
using (var cmd = conn.CreateCommand()) {
cmd.CommandText = "select * from tt where value = @val";
cmd.Parameters.AddWithValue("@val", (long)18446744073709551614ul).DbType = DbType.UInt64;
var reader = cmd.ExecuteReader();
...
} Die Energie der Welt ist konstant. Die Entropie der Welt strebt einem Maximum zu.
|
|
|
|
|
thanks Dmitry that did the trick abhinav
|
|
|
|
|
Good afternoon.
I currently write application to hook copy,cut,paste using ICopyHook whit visual studio 2008.
When I compile my application I have compil error CComModule can't not instantiate abstract class...
I try same code I found in codeproject compile whit vs 2005 and using vs 2008 I have same error.
Can you help me please thank you.
|
|
|
|
|
You need to post your code, in <pre> tags
aurelcly wrote: I have compil error CComModule can't not instantiate abstract class
This indicates that you are trying to create an instance of a class that is marked
abstract , which is impossible. Without the code it is we can't tell why this is happening.Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
|
|
|
|
|
Hi,
I have a question on windows application management. Lets take a look at my problem.
I am writing a windows application in C# 2005. I want that, at a time the application should run once. Unlike windows notepad or other programs the user can open as many windows he wants. But some trial software's don't allow opening more than one instance of same application.
Here, I also want the same facility(limitations) provided by trial software's. So that I can also run my application once at the same time.
|
|
|
|
|
|
Hi All,
In my application one thread waits for AutoResetEvents from various other threads.
I'm using WaitHandle.WaitAny(eventArray) to wait for any one of the events to become signalled then perform a switch on the returned index. My problem is that when 2 or more events are signalled at the same time I only get the array index for one event and the other signalled events are effectively lost. How can I ensure I respond to the other signalled events? It would have been better if subsequent calls to WaitHandle.WaitAny provided the index to these other signalled events on subsequent calls but it doesn't work like that.
Got any suggestions?
Thanks
Paulmodified on Thursday, February 18, 2010 3:55 AM
|
|
|
|
|
paul_b_baker wrote: It would have been better if subsequent calls to WaitHandle.WaitAny provided the index to these other signalled events on subsequent calls but it doesn't work like that.
Are you sure?
An AutoResetEvent remains signalled until it is used to satisfy a wait. WaitHandle.WaitAny is no different in that respect to WaitOne . So if two events are signalled at the same time, one will win the race to satisfy the wait and WaitAny will return it's index. The next WaitAny will succeed immediately and return the index of the other event.
Unless you mean that it is one event that is being signalled twice and one of the signals is being lost. This is a known problem with AutoResetEvent . If this is the case, you will have to use a different synchronization mechanism.
Nick----------------------------------
Be excellent to each other
|
|
|
|
|
Nick thanks but I'm quite sure I've got it right.
If two seperate events become signalled WaitHandle.WaitAny only returns the single lowest index and subsequent calls won't return the other signalled event indexes because, (I'm guessing here) AutoResetEvents are reset when the thread waiting on them runs. So my thread detects one event and runs but clears two or more events!?
Paul
|
|
|
|
|
Nick,
You're right.
In my code I added a check to see if a second event had been signalled when processing the first event. My check involved a call to WaitOne which reset the second event so (obvious after reading your post) I never saw it set in the main WaitAny loop!
I'm eating humble pie right now.
Thanks again.
Paul
|
|
|
|
|
Just some advice for future message posting...
Nick won't see that reply (because you replied to yourself) unless he visits the forum again and looks for this thread.
Further, when you edited your original post to change the title to "SOLVED", you should have put the solution in the original message as well. In a really long thread, very few people will hunt for the "solution" if it's buried deep in the message traffic..45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
No worries, we've all done it! I'm glad you got your bug fixed anyway.
If you can, I would do all threading development on VS2010. The RC is available and includes ( well at least the Ultimate version does ) some very useful new tools. In particular, the concurrency profiler shows you when waits are satisfied and by which thread, which would have been useful in this case.
If you really want to ensure correct code, there is also a CTP of a tool called Chess:
http://research.microsoft.com/en-us/projects/chess/[^]
It systematically explores synchronization interleavings by running tests ( it's a dynamic tool ). It's got a bit of a learning curve and you have to write the right tests, but it's worth it if you are unsure if your program is correct.
Nick----------------------------------
Be excellent to each other
|
|
|
|
|
Hi All,
I want to find how many elements have blank value and the number of that element using LINQ.
I dont want to iterate the array.
Please guy guide me.
Regards,
Sunil G.
|
|
|
|
|
It depends upon what you mean by "blank" but:
String[] foo = { "", "Hello", "", "World", "How", "are", "You", ""};
Console.WriteLine(foo.Count(x=> string.IsNullOrEmpty(x)));
Should give you some idea.
You'll need to change the predicate x=> string.IsNullOrEmpty(x) to suit your needs.Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
|
|
|
|
|
Thanks for your quick reply
It prints : 3.
I also want the index of the element.
In this example it is 0,2 and 7..
How is it possible?
Thanking You,
Sunil G.
|
|
|
|
|
Sunil G wrote: How is it possible?
Iteration. Something has to iterate the array, LINQ is just doing that under the covers.Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
|
|
|
|
|
"Blank" in what way? Array's don't have "blanks" in them, although an array of type T may contain elements with the value default(T) - is that what you want to find?
If so, you might do this: (!!untested!!)
static int CountEmpty<T>(IEnumerable<T> data)
{
return data.Count((T item) => object.Equals(item, default(T)));
}
Someone will have to iterate the array though, even if you don't do it yourself. Without looking at the whole array you can never know that there are no "blanks" left in the part that you skipped.
Except of course if you keep a count of how many elements of the array you changed from blank to non-blank (minus the ones you changed back to "blank") in the first place.
|
|
|
|
|
Good answer. I'd was thinking of null rather than default(T). Regards,
Rob Philpott.
|
|
|
|
|
I don't like to give up control; so I would write the iteration rather than have Linq do it.
|
|
|
|
|
Its your wish.
|
|
|
|
|
this.comboBox[store_num] = new System.Windows.Forms.ComboBox();
this.comboBox[store_num].FormattingEnabled = true;
this.comboBox[store_num].Location = new System.Drawing.Point(7, box_location );
this.comboBox[store_num].Name = "comboBox" ;
this.comboBox[store_num].Size = new System.Drawing.Size(68, 21);
this.comboBox[store_num].TabIndex = 0;
this.comboBox[store_num].DataSource = storeNameArray;
//
// textBox3
//
this.textBox[store_num] = new System.Windows.Forms.TextBox();
this.textBox[store_num].Location = new System.Drawing.Point(106, box_location);
this.textBox[store_num].Name = "textBox3";
this.textBox[store_num].Size = new System.Drawing.Size(76, 20);
this.textBox[store_num].TabIndex = 1;
priceArray[store_num] = this.textBox[store_num].SelectedText;
panel1.Controls.Add(this.comboBox[store_num]);
panel1.Controls.Add(this.textBox[store_num]);
store_num += 1;
box_location += 20;
I allow the user to add new ComboBoxes everytime they click add item. Now if there are two comboBoxes, when they select an item from the second one, it changes the first one as well. How do I stop that from happening, so each comboBox has there respective selections.
|
|
|
|
|
Since you didn't supply your own BindingNavigator for each combobox, the default navigator is used for all controls on the form.
The solution is easy. Create a BindingSource for each combobox. Set the DataSource property of the BindingSource to the data source you're currently using, then set the combos DataSource to the BindingSource you just created.
ComboBox1 ----> BindingSource1 ----> Data
ComboBox2 ----> BindingSource2 ----> Data
...
|
|
|
|
|
Hi,
using the smtpclient.SendAsync method, I want to know how much byte (or the percentage)
has been sent out of total bytes.
I didn't found a way to get status information from the client.
Is there another way (for example over the sockets interface) to retrieve these missing information
if yes, how ?
Thank you for your time
Frank
|
|
|
|
|
The SmtpClient doesn't report any progress information, so you cannot do what you want using the SmtpClient class. You'll either have to find a 3rd party library that does what you want or write your own SmtpClient class.
|
|
|
|