Unfortunately we are missing some more information.
But I suspect that in your table you have cString columns and you use the Format keyword to enter the numbers.
In the attached program there are two tables, Table1 with cNumber columns and Table2 with cString columns for the numbers and formatting the number display.
The csv file for Table1 is as you expect it.
The csv file for Table2 looks like yours.
The above represents a horizontal alignment, which is stored in a SQLite database. If you look at the above, you will notice that as soon as the value is bigger than 999.99, it encapulates the number with ". Everything smaller than 1000 is OK.
I am not a SQL specialist, but how are thenumbers stored in the data base? In a string field or a numeric field.
Do you initialize the table columns before loading the data base? If yes are is the column type cString or cNumber?
I am afraid that the problem is in the data base and not in the table. I tried in the test program to enter the numbers in cString columns, but commenting out the lines with the Format keywords, and the csv file is OK.
Sorry for being a pain in your backside! But I need to resolve this problem.
Here is how I save my alignment files:
Code:
Sub SaveHorPi_Click If Textbox1.Text=""Then Textbox1.Text=Format(0,"N3") If Textbox4.Text=""Then Textbox4.Text=Format(0,"N3") If Textbox5.Text=""Then Textbox5.Text=Format(0,"N3") If Textbox6.Text=""Then Textbox6.Text=Format(0,"N3") If Textbox2.Text<>""AND Textbox3.Text<>""Then If Code=1Then rec=rec+1 text="insert into HorPi (No,StartSv,PiYCoord,PiXCoord,Radius,TransIn,TransOut) values ('" text=text & rec & "','" & Textbox1.Text & "','" & Textbox2.Text & "','" & Textbox3.Text & "','" & Textbox4.Text & "','" & Textbox5.Text & "','" & Textbox6.Text & "')" cmd.CommandText=text cmd.ExecuteNonQuery ElseIf Code=3Then CheckAlign If Engine.j<>-999999Then rec=rec+1 text="insert into Align (No,StartSv,YCoord,XCoord,Radius,Length,Code,Stake) values ('" text=text & rec & "','" & Textbox1.Text & "','" & Textbox2.Text & "','" & Textbox3.Text & "','" & Textbox4.Text & "','" & Textbox5.Text & "','" & Textbox6.Text & "','" & Textbox7.Text & "')" cmd.CommandText=text cmd.ExecuteNonQuery EndIf EndIf Textbox2.Focus EndIf End Sub
All the values get entered into "Textboxes"
This is how I open the database:
Code:
Sub OpenHorPI Con.New1 Reader.New1 DirCreate("Data") Cmd.New1("",con.value) Con.Open("Data Source = " & AppPath & "\Data\" & Main.Job & ".sl3") If Code=1Then cmd.New1("CREATE TABLE IF NOT EXISTS HorPi (No,StartSv,PiYCoord,PiXCoord,Radius,TransIn,TransOut)",con.value) ElseIf Code=3Then cmd.New1("CREATE TABLE IF NOT EXISTS Align (No,StartSv,YCoord,XCoord,Radius,Length,Code,Stake)",con.value) EndIf cmd.ExecuteNonQuery If Code=1Then cmd.CommandText="Select * From HorPi " ElseIf Code=3Then cmd.CommandText="Select * From Align " EndIf Reader.Value = Cmd.ExecuteReader Combobox9.Clear DoWhile Reader.ReadNextRow=True rec=rec+1 Combobox9.Add(Reader.GetValue(0)) Loop reader.close End Sub
Logic (I think I have some!) tells me that should my data be strings, then surely the numbers smaller than 1000 should also have had " around them. But they do not have them!
It is only for number => 1000 which have them..i.e. <1000 = 999.99, but >=1000 = "1,000.00" Does the "comma" not have anything to do with it?
It is always easier if you can post some example code otherwise we have to try and build forms etc to see what is happening and it wastes a lot of time!
I suspect the problem is to do with numbers being returned as strings and any >999 being formatted with commas on return from the query. SaveTable appears to save anything it recognises as a valid number without quotes, even if it is in a cString column. Because the commas make it a non-valid number such numbers are saved as quoted strings. Can you see the commas in the table entries?
Did you specify the columns in the Table control you used to create SQLite table as cNumber?
When you enter the values into the TextBoxes do you also use something like TextBox2.Text=Format(AnyNumber,"N3") ?
If yes I think that's the problem, the Format instruction introduces a comma every thousands. For example 1234567.34523 becomes 1,234,567.345 !
Are the numbers in the database put into number fields or string fields.
I modifyed the test program with 2 TextBoxes where I enter 2 numbers with Format. In Table1 with cNumber columns the text from the TextBox is converted to a number without the comma and the csv file is also OK. But in Table2 with cString columns the numbers become strings and they are displayed and transfered as those with the commas.