I am trying to write a program that sends data from a DataTable to an Microsoft Access Database (mdb format) using an OleDBConnection. The regional settings of my computer are set to "Greek". The problem is that the decimal numbers stored in the datatable cannot be transferred correctly to the Access Database. For example, the numer 15.34 (where "." is the decimal point for the US Regional Settings) is stored as 15.340,00 (where "," is the decimal point for the Greek Regional Settings).
I have tried to set the regional settings from inside the source code (using the CurrentThread.CultureInfo to "Greek") but that only applies to System.String values, and NOT decimal or floating point. For this reason, the values cannot be stored correctly into the Access DB file. The only way to correct this problem is to manually change the regional settings from the Control Panel, but I would like to avoid this solution.
I would appreciate it if you could help me with this issue.
I had a similar problem some weeks ago using MSDE. I was storing dates using DateTime.ToLongDateString() and DateTime.ToShortTimeString(), but I found out that it generated an exception on systems where Windows was localized to Spanish (dates in Mexico are DD/MM/YYYY as oppossed to MM/DD/YYYY).
What I did was to manually construct the date string using DateTime properties (Month, Day and so on) and it worked well on both my English development machine and those in Spanish where it was tested.
Richard Smith wrote: Does anyone have any hints as how to implement a progress bar for a status panel?
I think you can host controls inside a statusbar panel. But it would probably be better to do a custom statusbar...
Typically a StatusBar control consists of StatusBarPanel objects, each of which displays text and/or an icon. You can also provide owner-drawn panels to provide custom panels such as a progress bar or a series of images that displays the state of your application.
The default StatusBar has no panels. To add panels to a StatusBar you can use the Add method of the StatusBar.StatusBarPanelCollection class that is accessible through the Panels property of the control. You can also use the StatusBar.StatusBarPanelCollection object provided through the Panels property to remove panels from the control and access a specific StatusBarPanel object to manipulate the panel.
Now just add the progress bar to the panel
Before you criticize a man, walk a mile in his shoes. That way, when you do criticize him, you'll be a mile away and have his shoes.
Basically, you can put the progressbar control on the status bar on the design
But, as you know, this progressbar parent is the Form.
So, if we change the size of the form, we also have to change the location
of the progress bar.
After we get Top and Left of the status bar, we easily update the location
of the progress bar.
(However, I didn't check the functionality of the progress bar.)
Please, don't send me your email about your questions directly.
Have a nice day!
Sonork - 100.10571:vcdeveloper
You might consider what Masaaki has suggested, however I tried something extremely simple which I believe take a lot of the pain out of it.
Basically add a status bar to your form, then drag a progress bar onto the status bar placing it in the lower left hand corner of the status bar, you do not need to add a panel to the status bar. With the progress bar item selected go to the Anchor property and click on both the Bottom and Left "bars". The text value inside the Anchor property should read "Bottom, Left". Run your app, the progress bar will stay in sync with you form at all times now.
The greatest lesson in life is to know that even fools are right sometimes. - Winston Churchill
When i run this program,it says Must declare the variable '@Country'.
What should i do.
string selectSQL = "SELECT CustomerID, CompanyName FROM ustomers WHERE Country = @Country AND City = @City";
OleDbConnection nwindConn = new OleDbConnection("Provider=SQLOLEDB;Data Source=localhost;" +
"Integrated Security=SSPI;Initial Catalog=northwind;");
OleDbDataAdapter custDA = new OleDbDataAdapter();
OleDbCommand selectCMD = new OleDbCommand(selectSQL, nwindConn);
custDA.SelectCommand = selectCMD;
// Add parameters and set values.
selectCMD.Parameters.Add("@Country", OleDbType.VarChar, 15).Value = "UK";
selectCMD.Parameters.Add("@City", OleDbType.VarChar, 15).Value = "London";
DataSet custDS = new DataSet();