Click here to Skip to main content
15,798,200 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a Windows Phone 8.1 application. I have a Text type column in the database. When I insert data into the column, and the data contains a leading zero (Fe.: 02343) then db engine stores it without zero (2343). The insertation is from a List<mytype> object by SqlLiteConnection.InsertOrReplace(object obj) method. I check the source list<> it contains the 0 char. What should I do to store leading zero too?
Updated 7-Oct-15 3:05am

1 solution

If 02343 is a number the leading zero is only for display (a formatting) and has no meaning as 0123 is the exactly same thing as 123 - in numbers...So SQL will save it as number and fo that the leading zero will be gone...If you want the numbers to be displayed wiht leading zero in your application you have to the right formatting everywhere in your application...
Share this answer
Kornfeld Eliyahu Peter 7-Oct-15 14:48pm    
To a string representation of a number to lost its leading zeros somewhere in the process it must be converted (casted) to numeric type...You have to check the code for the insert to see...You may post that part to see if someone spots the problem...
DeveloperEU 8-Oct-15 2:44am    
The problem is in sqlite.cs somewhere. I follow the code to the last debugable line in SQLite.cs. It was the SQLite3.BindText(...) function where the property has the right value yet. The later operations runs in sqlite3.dll.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900