Hello,
.Net 2.0
I am creating a windows forms application for deployment on a client's machine.
The program works fine on my local but the output on the client machine is wrong.
Since the problem only occurs on the client's machine I cannot debug it.
Essentially the program reads in data from an excell sheet, does some processing and then outputs to a text file the results.
I convert the strings from the excel file to doubles and
1.23 -> 0.23 10.23 -> 0.23 11.23 -> 1.23 12.23 -> 2.23 149.10 -> 49.10
on the client's machine. Unfortunatly 0.24 stays as 0.24, same with 2.34 etc.
So I can't fix the data after it has been read in.
I am thinking that this problem has something to do with the client's excel settings on their machine.
Using an OleDbConnection with connection string
@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=Excel 8.0;"
I select * from my sheet and fill my dataset.
I'm flabberghasted, I have no clue what is going on...
Any ideas?
Thanks,
-Biff
11 1236
I cannot figure out what you are doing to those numbers. At first I though you were just taking the portion after the decimal, then I thought you were subtracting 10..then I thought maybe you were removing the first digit.
None of them seemed to fit.
What you could try doing is, half the program read in the values from the excel sheet, and then write out what it thinks it got to a textfile (or whereever) and then write out a before and after value, see if you can see what is going on?
I cannot figure out what you are doing to those numbers. At first I though you were just taking the portion after the decimal, then I thought you were subtracting 10..then I thought maybe you were removing the first digit.
None of them seemed to fit.
What you could try doing is, half the program read in the values from the excel sheet, and then write out what it thinks it got to a textfile (or whereever) and then write out a before and after value, see if you can see what is going on?
Thanks for the reply!
Yeah it is pretty bizzare alright. As far as I can tell if the number starts with a 1 it is clipped off.
My program is trying to not do anything to the numbers hehe.
In the meantime I've tried adding IMEX=1 to my connection string but the results were the same.
So if you tell your dataset to WriteXML() (or whatever it was called), it still is missing the first character?
So if you tell your dataset to WriteXML() (or whatever it was called), it still is missing the first character?
Hmm, writeXML gives correct values... I guess for some reason double.Parse on the client is not working the same as on my local...
you don't do anything wierd like assume the value starts with a " or anything like that do you?
you don't do anything wierd like assume the value starts with a " or anything like that do you?
This is essentially what I do. - foreach (DataRow myRow in dataTable1.Rows)
-
{
-
if (myRow["Column1"] != null && myRow["Column1"].ToString().Trim() != "")
-
{
-
myDoubleList.Add(double.Parse(myRow["Column1"].ToString()));
-
}
-
}
-
And then I spit that List of doubles to text file.
These results are off of my client's machine
Text -> after double.Parse().ToString()
0.05 -> 0.05
0.23 -> 0.23
0.37 -> 0.37
0.42 -> 0.42
0.45 -> 0.45
0.5 -> 0.5
1.05 -> 0.05
1.1 -> 0.1
1.11 -> 0.11
1.15 -> 0.15
1.35 -> 0.35
1.37 -> 0.37
1.61 -> 0.61
1.72 -> 0.72
3.13 -> 3.13
3.16 -> 3.16
3.17 -> 3.17
3.21 -> 3.21
3.4 -> 3.4
3.47 -> 3.47
3.67 -> 3.67
3.74 -> 3.74
4.11 -> 4.11
4.2 -> 4.2
4.34 -> 4.34
4.43 -> 4.43
6.72 -> 6.72
6.76 -> 6.76
6.76 -> 6.76
6.8 -> 6.8
7.37 -> 7.37
7.42 -> 7.42
7.42 -> 7.42
7.46 -> 7.46
9.9 -> 9.9
10.13 -> 0.13
11.47 -> 1.47
11.57 -> 1.57
Maybe I'll add "1" to the begining of every string...
If all you are doing is writing them back to a text file, why do the double.parse() at all?
You could do a .TryParse() to make sure they are numerical data, then just write out the regular string.
does float.parse() work any better then double.prase()?
If all you are doing is writing them back to a text file, why do the double.parse() at all?
You could do a .TryParse() to make sure they are numerical data, then just write out the regular string.
does float.parse() work any better then double.prase()?
I use the double to perform some calculations on other numbers. :)
Thanks for your input.
I finally solved the problem though.
I added -
private static System.Globalization.CultureInfo cultureInfo = new System.Globalization.CultureInfo("en-US");
-
myDoubleList.Add(double.Parse(myRow["Column1"].ToString(), cultureInfo));
-
I'm not sure what culture cuts off the leading 1s on all their numbers but I'm glad that this problem is solved. :D
Thanks again for your time Platter.
-Biff
Perhaps some culture specs mandate a leading sign character (+ / -) and it was just wipping it out?
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Edward |
last post by:
SQL Server 2000 Enterprise Edition
Access 2000 Front End
One of our clients has recently been experiencing problems with an app
that has run satisfactorily (though slowly) for some time. To...
|
by: Andrew Mayo |
last post by:
This problem was discovered with MSDE2000 SP2 and under WinXP SP2. We
are unsure whether it is more widespread as it has only been seen on
one machine to date.
The problem is related to name...
|
by: Frances Del Rio |
last post by:
I'm connected to internet via Comcast cable modem, very fast connection,
usu. have no problems, but all of a sudden there are a number of sites I
can't get to (while others no problem.. very...
|
by: CT |
last post by:
Hi,
This might seem like a basic question but I have some doubts, please
humour me.
I have a client-server application using java where each client on
each machine needs to directly...
|
by: Krzysztof Bartosiewicz |
last post by:
Hi!
I have a problem with an access database. The database which I designed and
made using MS access works perfectly OK on my computer however it is not
working at all on computers for which it...
|
by: Strange Cat |
last post by:
Hi everyone!
I have a weird problem with FormsAuthentication.
I have an app that works just fine with FormsAuthentication.
The user requests the homepage, he is redirected to login page,...
|
by: Don Munroe |
last post by:
This one has me stumped. I have three web applications running on two
different servers. The first that works fine is hosted by a .Net hosting
company. Everyone that uses it has no problems...
|
by: Khalique |
last post by:
I have built a web service whose purpose is to copy files from a secure place
to client machine and vice versa. The problem I am having is perhaps related
to permissions and access rights.
For...
|
by: robinsiebler |
last post by:
I have a data structure that looks like this:
# dates = {'2007': {'25': {'06/23/07': {'aerosmith': ,
# 'Metallica': },
# 'last_song': }}}...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |