Transfering DateTime fields from MSSQL to SQLite Problem

infow

Member
Licensed User
Longtime User
Hi,

Im following the Tutorial: http://www.b4x.com/forum/basic4andr...android-ms-sql-server-tutorial.html#post74199

Its working just fine, but, Im having problem with datetime fields. The data its inserted ok, but when I tryed to see in SQL Browser or SQLite Admin, gives wrong dates.

MY DATE FORMAT:
11/11/1973 12:00:00 AM
D/M/YYYY HH:MIN:SEC AM/PM

FORMAT IN ASP.NET:
11/11/1973 12:00:00 AM
M/D/YYYY HH:MIN:SEC AM/PM

PARSED DATE :
\/Date(121831200000)\/

DATE IN DB(SQLite Administrator):
30/12/1899 12:18:31

Any help will be great.

THanks in Advance.
 
Last edited:

infow

Member
Licensed User
Longtime User
I solved sending the dates as Text, replacing the original sample with this:

B4X:
            Dim d As New Dictionary(Of String, Object)(rdr.FieldCount)
                        For i As Integer = 0 To rdr.FieldCount - 1
                            If rdr.GetFieldType(i) Is GetType(Date) Then
                                If rdr.IsDBNull(i) = True Then
                                    d(rdr.GetName(i)) = rdr.GetValue(i)
                                Else
                                    d(rdr.GetName(i)) = rdr.GetDateTime(i).ToString("yyyy-MM-dd HH:mm:ss")
                                End If
                            Else
                                d(rdr.GetName(i)) = rdr.GetValue(i)
                            End If
                        Next

If there is anyway better please share. If not, you can update the Tutorial sample to this.

Thanks in Advance.
 
Last edited:
Upvote 0
Top