|
Hi Everyone,
Iam struck with sending a decimal parameter to a stored procedure. Can anyone help us in this regard
cm.Parameters.Add("@test", SqlDbType.Decimal);
Regards,
Manowj
|
|
|
|
|
What error are you getting?
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Hi,
I am getting the below error when i passed
cm.Parameters.Add("@Qty", SqlDbType.Decimal);
Failed to convert parameter value from a String to a Decimal.
Regards,
Manowj
|
|
|
|
|
Check the value you are passing in @Qty. Are you passing a correct decimal value?
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
No string should be involved; how are you setting the Value of the parameter?
I would use cm.Parameters.AddWithValue("@Qty", datetimepicker.Value )
Don't make a value into a string and then parse it back to the type is was.
|
|
|
|
|
Edit: It seems I was incorect with this statemnt.
|
|
|
|
|
|
Hi,
Can You please Tell me what is the difference between 'byte' and 'Byte' as a datatype in C#
thank you.
|
|
|
|
|
No difference really, just different names for the same thing.
'byte' is just short for System.Byte. It's a primitive so has shortened form.
Regards,
Rob Philpott.
|
|
|
|
|
|
|
Byte is NOT a wrapper for byte.
'byte' is a C# keyword that is a synonym for 'System.Byte'.
In computing, the word 'Wrapper' has a different meaning.
|
|
|
|
|
You are confusing with java. in C#
byte == Byte
string == String
...
...
..
..
|
|
|
|
|
None. One's a synonym for the other.
"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
|
|
|
|
|
The only difference is when defining an enumerated type; byte and the other aliases are allowed, but System.Byte etc. are not.
|
|
|
|
|
you know, select a tree node, it would be highlighted with blue color, if the tree lose focus, the color would be gray, it's hard to know which one is selected, is there a good way to change the gray to a light color? Or need to redraw the node?
if need to redraw the node, there would be many works need to do, like restore the node etc.
Is there a good sample to show this?
Thanks you!
|
|
|
|
|
Did you change the color of the TreeNode.
Also dont forget to call TreeView.Invalidate() method to force tree view to repaint.
|
|
|
|
|
|
Set HideSelection to false. When the TreeView does not have the focus, the selected node will be displayed in a light gray shade. If you want to change that, you need to have an owner drawn TreeView.
|
|
|
|
|
Yes, I have set HideSelection to false, but the gray color is too white, it's hard to see.
Is there a sample to show how to redrawn the Treeview? Or is there a easier way to resove it?
|
|
|
|
|
Just google "Owner draw TreeView in .NET"
|
|
|
|
|
I´m developing a Windows Forms app with C# 2003. Well, I´ve got a DataGrid control with 2 Date columns with "dd/MM/yyyy" format...the trouble is that when I click that columns' headers they get obviously sorted by day, then month, and then year (01-02...30,31)...and I want them to get sorted by year, then month and then day...I´ve placed this code on the datagrid_mouseup event...so when the datagrid sorts the column it will do it correctly...but I don´t know how to revert back the date format, because the sorting method seems to be internal and performed after all other DataGrid´s events are processed. So how could I know when DataGrid has finished sorting to put the dates into their former format? (or other way of doing it, of course). Thanx.
<pre>
DataGrid.HitTestInfo hitTestInfo = myDataGrid2.HitTest(myDataGrid2.PointToClient(Control.MousePosition));
if (hitTestInfo.Type==DataGrid.HitTestType.ColumnHeader)
{
if ((hitTestInfo.Column==2)||(hitTestInfo.Column==3))
{
for (int i=0;i<Avisos.Rows.Count;i++)
{
DateTime myDateTime = DateTime.ParseExact(myDataGrid2[i,hitTestInfo.Column].ToString(),"dd/MM/yyyy",null);
myDataGrid2[i,hitTestInfo.Column] = myDateTime.ToString("yyyy/MM/dd");
Application.DoEvents();
}
}
}
</pre>
modified on Thursday, November 26, 2009 6:32 AM
|
|
|
|
|
HI,
Your code looks evil. Application.DOEvents() is a bad call.
Re-think and do this in a different way and not with a hit test ??
How much data is on this grid ?
|
|
|
|
|
Forget that order. I´put it there just to place a breakpoint over it...but...why Application.Doevents is "evil" as you say?
If I found a better option (or an option that could work, at least) be sure that I will take it .
We are talking about 200 records more or less.
|
|
|
|
|
Hi,
As you can see in other responses, Application.DoEvents consumes all kinds of events such as user clicking buttons and can cause unexpected application states. It can also be a very heavy call to make in a loop, since you do not really know what or how much code will be executed. I am not saying never use it but use with extra caution (try not to use it).
I asked for the number of records since you can use a list view in which sorting is very simple. Sorting list view C#
|
|
|
|