|
Decimal is also 128-bits in size compared to the 32-bit for a float... A little overkill for the application...
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote:
Decimal is also 128-bits in size compared to the 32-bit for a float... A little overkill for the application...
Yes, decimals are stored as 16 bytes (but only 13 of them are used, pity) In any case they're much slower than a float, since they are structs and do not have hardware support. But I think it's OK unless you're programming a game or an embedded system in a spaceship 
|
|
|
|
|
No, I don't think that I'll use decimal, espcially since I was worried that converting the int to a float every thime the window was invalidate would be too expensive (a few second later I figured out that I could store both -- do the math on the int and convert to float whe the scale changes.)
I guess the major question is why when you write a prog in C/C++ do you get the "right"/expexted answer and in C# you don't. Ah well, if it still bothers me tommorrow I may take a journey down assembly lane and look at the disassembly for the C code. Another thing I was considering checking is to simply assign various values to a float an view the results...
|
|
|
|
|
Hi Heath,
You told me about putting an Update statement followed by a semicolon with select for my dataadapter.Update command. Can I use this same syntax for the dataadapter Insert and delete commands as well or does this only need to be done for one of them and the others respective commands will use the same select?
Thanks,
JJ
|
|
|
|
|
No, I said to use an INSERT followed by a SELECT. This is to ensure that any fields filled by the database engine are reflected in your DataSet . An UPDATE doesn't require this - you already have the field values.
See my previous post on this subject here[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Re: Adding Rows to Dataset Heath Stewart 19:29 13 May '04
Use something like the following for your SqlCommand you set as the
Heath Stewart wrote:
SqlDataAdapter.UpdateCommand:UPDATE MyTable SET Field1 = Value1; SELECT * FROM MyTable;
The SELECT statement should actually match the SQL statement you use for your SelectCommand.
Microsoft MVP, Visual C#
This is what u said here <link[^]>http://www.codeproject.com/script/comments/forums.asp?msg=821216&forumid=1649&XtraIDs=1649&searchkw=commandbuilder&sd=5%2F10%2F2004&ed=5%2F26%2F2004#xx821219xx
Did I interpret this wrong ?
JJ
|
|
|
|
|
No, that was a mistake on my part. But if you look at the reply to your post earlier today I did state to combine your INSERT statement with your SELECT statement.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I fixed the linked post for posterity.
If you want to see an example of what you need to do, you could use the designer in VS.NET. The DataAdapter -related designers will help you fill all the commands of a DataAdapter and the InsertCommand will contain both an INSERT and SELECT statement for the very reasons I mentioned.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello,
I'm entering new territory for me here, so I appologise in advance if I dont't use the correct terminology. I want to communicate between to programs on the same computer. The best annaology I can come up with is how Winamp or MediaPlayer allows you to enqueue files from the Shell menu to the running application. I want to specify a file to import into a running application. Whats the best way (no security needed) to create a communication channel where I can send a string from one app to another. I've started looking into Remoting, but this might be overkill. Could I use the FindWindow and SendMessage APIs to send a string to my application ? If so how do I check for these incoming messages ?
Any suggestions would be helpful. Thanks.
|
|
|
|
|
I'm going to let other people get into some of the details because my experience with Remoting is lightweight compared to other people here...
You're looking to have a 2nd instance of an app throw a string, or whatever else, at the 1st instance of your app, then quit.
Remoting is not the overkill you would think it is. It's actually going to give you the best bang for your buck as far as flexibility, being able to pass any object you want and send information back to the caller.
Using the SendMessage and FindWindow API's is actually a VERY limited method of communication and frankly, not that reliable in this case you have to garantee that the window that your talking to isn't the window your sending from. In others words, an instance of an app can end up talking to itself instead of a previous instance. Plus, you have to register your own custom message and you would have to pass a pointer to a String or other object. You can't send a copy of the string itself.
There are a couple of other methods that are written up in these articles on CP here[^], here[^], and here[^]. But these methods are not elegant, more like hacks really (no offense ) because they can't be written in totally managed code, and have their pitfalls and, I think, are limited to just passing a single string.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks for the info....you suppose you could suggest an approach in Remoting ? Since I have no experience, your "lightweight" experience is more than I have...
|
|
|
|
|
is it possible to create a new group at run time?
|
|
|
|
|
With the VERY limited experience I have with Crystal Reports, no you can't. I believe report classes are immutable at runtime.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
The report definition in CR for VS.NET is read-only. You could take a look at their newer, full-fleged products. This isn't a Crystal Reports forum, though, so you should direct your questions to their site.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I believe you would need the "Advanced Developer" version of Crystal Report 10 to be able to do that.
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
|
|
|
|
|
THanks ,I'll try out their trial version
|
|
|
|
|
Hi!
I have a menu using the Checked property on top of a window and I want to duplicate it:
1: As a drop down menu on a ToolBarButton
2: As a popup menu on the status bar.
- I have created my menu
- I have copied my menu into a Context menu this way:
typeContextMenu.MenuItems.Add(subMenu1.Index, menuItem1.CloneMenu());
typeContextMenu.MenuItems.Add(subMenu2.Index, menuItem2.CloneMenu());
(suppose the menu contains 2 MenuItems)
Anyway, everything works fine BUT the checkboxes don't update in the context menu! They only update in the initial Menu...
I understand that this may be because the ContextMenu works on a copy of the initial menu... so I tried to assign them without the CloneMenu Method but then the initial menu disappears!
What can I do?
|
|
|
|
|
When you clone a menu item, you make a copy of it. The checks are disjoint and you would then have to update them all. Also, a menu item can only belong to one menu, which is why the initial disappears when you add it to another menu.
Just keep a list or array or something of related MenuItem s and update each's checked state.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I'm sure the answer to this is obvious, but I haven't been able to find an example of this yet...
I have a datagrid that I have made editable. How do I get rid of the columns for a row that is editable, but leave the columns on all the other datagrid rows?
[Edit] This is for a Website so I'm looking for a solution for the Web DataGrid control [/Edit]
|
|
|
|
|
You'll need to create a DataGridTableStyle for you grid. This should get you started:
DataGridTableStyle style = new DataGridTableStyle();<br />
style.MappingName = "Table";
<br />
DataGridColumnStyle Style1 = new DataGridTextBoxColumn();<br />
Style1.Width = 100;
Style1.MappingName = "TableColumn1";
Style1.HeaderText = "Column1";
<br />
DataGridColumnStyle Style2 = new DataGridTextBoxColumn();<br />
Style2.Width = 100;
Style2.MappingName = "TableColumn2";
Style2.HeaderText = "Colunn2";
<br />
style.GridColumnStyles.AddRange<br />
(<br />
new DataGridColumnStyle[]<br />
{<br />
Style1, Style2<br />
}<br />
);<br />
<br />
dataGrid1.TableStyles.Add(style);
As you can see, you can put any columns in your datagrid from your source that you choose, and omit the rest. You can do a lot with the datagrid, but this is a good starting point.
|
|
|
|
|
I guess I forgot to mention that I'm dealing we the Web DataGrid and not the Windows Forms datagrid. Thanks for the reply though. I couldn't find DatGridColumnStyle for the Web DataGrid.
|
|
|
|
|
Hi,
If I send a dataset to a dataadapter to update a database the second time after its been disconnected from the dataadapter will it pick up only the rows that need to be added to the database and not the ones already in the database? and will this also update rows in database that have changes in existing rows? I am retrieving a dataset from file and adding rows to it then feeding the new rows to the dataadapter to update DB but only want the new rows to be added and not of course existing ones.
Thanks,
JJ
|
|
|
|
|
If you have all the command properties set to a valid command object, then the DataAdapter will only update existing rows, insert new rows, and delete removed rows. Make sure you do not call DataSet.AcceptChanges yourself, or the DataAdapter will not see any changes. You should also combine your INSERT statement with a SELECT statement (separated by a semi-colon) so that auto-filled fields are updated in the DataSet .
If you're marshaling the DataSet across remoting boundaries, you might consider calling DataSet.GetChanges and send only the DataSet containing those changes. You would then, of course, have to call DataSet.Merge to merge the changes. This is really only useful when you need to marshal the DataSet across remoting boundaries.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi Heath,
Ok the DataAdapter is in a web service on the same pc as the database. I am sending the dataset over the network to the web server. Does this constitute going across remoting bounderies?
Thanks,
JJ
|
|
|
|
|
No. Going across remoting boundaries would be like sending the DataSet to a Web Service from a client proxy, or to a Remoting object. There's other examples, too, but if the DataAdapter is just issueing commands based on the DataSet changes, that is normal behavior.
Microsoft MVP, Visual C#
My Articles
|
|
|
|