Click here to Skip to main content
15,122,406 members

Comments by R. Hoffmann (Top 33 by date)

R. Hoffmann 3-Jun-11 10:05am View
I've just tested this again in Office 2007, and it also doesn't change the colours. Microsoft may have changed some or other implementation somewhere between Office 2003 & 2007, that breaks this solution. In any case, I'm very grateful for all your assistance! Member Ruard has provided an alternative idea that did the trick, so this question can finally be closed :)

Thanks again!
R. Hoffmann 3-Jun-11 9:57am View
Aaaaaand we have a WINNER! Your code does the trick. Thanks a million!!
R. Hoffmann 2-Jun-11 12:47pm View
Thanks for your answer! I'll be able to test this tomorrow and provide feedback.
R. Hoffmann 2-Jun-11 12:37pm View
Thank you very much! Unfortunately this doesn't seem to work under Office 2010 (which is the only version I have available at the moment for testing). The ClearFormats call causes a border to appear around the chart, which the LineStyle = 0 statement later clears, and the position of the slices change when FirstSliceAngle is set, but those are the only changes. The solid colour unfortunately remains..

Tomorrow I'll test this under Office 2007 to see if that makes a difference.

Thanks again!
R. Hoffmann 2-Jun-11 9:55am View
Hi losmac,

Thanks for your continuing interest! I've quickly uploaded a sample file to here: (20KB). I apologize for the stupid enforced delays before you can download, I didn't have time to pick a better free hosting service.
R. Hoffmann 31-May-11 16:01pm View
Thanks for your explanation, I've updated my answer with some hints that may be useful. My C++ is too rusty to do much more :)
R. Hoffmann 31-May-11 15:44pm View
I'm happy to have been of service :)
R. Hoffmann 31-May-11 14:58pm View
And when I say "the pic table doesn't exist", I mean it doesn't exist in the DataSet. It may exist in your actual database, but as I said, the DataSet doesn't know that, it's simply a "dumb" container for data.
R. Hoffmann 31-May-11 14:58pm View
And when I say "the pic table doesn't exist", I mean it doesn't exist in the DataSet. It may exist in your actual database, but as I said, the DataSet doesn't know that, it's simply a "dumb" container for data.
R. Hoffmann 31-May-11 14:56pm View
This will be because your DataSet is empty - the part that says "ds.Tables["pic"]" returns a null because the "pic" table doesn't exist, and when you then call ".Rows" on it, it throws an exception.

You must understand that a DataSet is simply a container for data, it isn't capable of getting the data by itself. You need to add code to read data from the database connection you instantiated and put it into the DataSet, between where you create the Dataset and where you try to get the rowcount, for this to work. Your existing code is good, it is just a little incomplete.
R. Hoffmann 31-May-11 14:33pm View
Edit: formatted code and added category tags.
R. Hoffmann 25-May-11 14:58pm View

The pie chart already exists, and I only need to change its formatting (the underlying data stays the same). Currently the pie charts have multiple slices, but all slices have the same colour (normally, when you create a new pie chart in Excel, then the colours are set to "Automatic", and Excel makes each slice a different colour). Basically I'm just looking for a way to get Excel to once again automatically make the slices in the pie charts each have a different colour.

Does that make more sense?
R. Hoffmann 24-May-11 15:02pm View
Wow, a descriptive title, decent amount of info in the question, details of what has been tried already, clear questions in the end.. Oh, *and* the question is tagged nicely. Unfortunately I'm not able to help you with your queries, but I just want to say well done on formulating the question! It's so refreshing to come across something like this :)
R. Hoffmann 23-May-11 11:07am View
Cool, glad that's sorted :)
R. Hoffmann 22-May-11 17:13pm View
It depends: if you're getting back a string from ExecuteScalar, then you're not going to get it much neater than what you have now. You could get rid of the temp variable, and put cmd_id.ExecuteScalar().ToString() into the Parse call directly, but that's it. You might want to add code to handle DBNulls though, for when there is no last ID to retrieve.

However, have a look at what the type of the return value actually is (under the debugger). Maybe you can still use your original code, but with the correct type (i.e. not int). Maybe it's of type uint or something. E.g. _id = (uint) cmd_id.ExecuteScalar();
R. Hoffmann 22-May-11 9:13am View
Can you provide details on what kind of database you're using? Is it Access?
R. Hoffmann 22-May-11 6:38am View
Don't post additional information as a solution, please. Rather edit the question and add it there.
R. Hoffmann 21-May-11 20:19pm View
R. Hoffmann 21-May-11 20:09pm View
That comment deserves a 5!
R. Hoffmann 21-May-11 15:04pm View
Another thing, this won't fix the problem you're getting but is important nevertheless: your UPDATE statement inserts an additional space at the end of the password you're getting from the textbox, so what is stored in the database is different to what the user entered. This is probably a typo.

string update = "UPDATE Login SET Password = '" + TextBox2.Text + "-->Remove space here<--' WHERE UserId = '" + dtr[0].ToString() + "'";
R. Hoffmann 21-May-11 15:01pm View
I just tried the update statement in Management Studio, and it executes fine, although the syntax highlighting does recognize "Login" as a reserved word. However, I used SQL Server 2008 R2, and you are connecting to Access, so that is perhaps why it doesn't work on your side.

Have you tried CS2011's suggestion of enclosing the table name in square brackets? I think Prem Shanker Verma and CS2011 are correct with their diagnosis. Don't know who voted them down.
R. Hoffmann 21-May-11 14:16pm View
Looks like the code got truncated. And please edit your original question and add the complete code there instead of pasting it in a comment.
R. Hoffmann 12-May-11 9:48am View
See my reply above :-)
R. Hoffmann 12-May-11 9:47am View
I just created a new empty database in SQL Server 2008, and ran the schema creation scripts that OP provided. Then I ran the stored proc, and it does return the State field.
R. Hoffmann 12-May-11 8:01am View
Wouldn't the fact that the original query contains an asterisk mean that all fields from the joined tables are returned, even if not specifically listed by name?
R. Hoffmann 12-May-11 7:58am View
Isn't it? Doesn't the asterisk in the SELECT include all fields from the State table as well?

select Customer.City AS City1,State.City AS City2,Customer.Sr_No as Sr_No1, * from Customer full Join State
R. Hoffmann 11-May-11 3:47am View
R. Hoffmann 10-May-11 16:57pm View
Ah, very good find!
R. Hoffmann 10-May-11 15:47pm View
Thanks :)
R. Hoffmann 10-May-11 15:43pm View
Sorry, I'm not familiar with MySQL at all, but this page may be of help:

Seems like they
1. execute the function using mysql_query, which returns a resultset of some sort,
2. call mysql_fetch_assoc on the resultset to obtain the next row from it, which is returned,
3. and lastly, refer to a specific value in the row by using an indexer in the form of the field name to be returned.
R. Hoffmann 29-Apr-11 19:45pm View
Can you post the errors you're getting?

It's certainly possible to have a WHERE clause in the SELECT being used as the adapter's SelectCommand (see, the Examples section).

Perhaps the dates are not in the correct format, and using placeholders and providing your dates as DateTime objects (thereby allowing the system to take care of the format) would solve the issue.
R. Hoffmann 22-Apr-11 12:20pm View
To get the number of pages in a document, try the code in this article: It calls on Word to provide document statistics, specifying that it wants the number of pages.
R. Hoffmann 21-Apr-11 18:06pm View