samedi 28 mars 2015

sqlite database, vb.net, string was not recognised as a valid datetime

I have vb.net program and SQLite database.


A "String was not recognised as a valid date time ERROR" is thrown when ever I try to display a table info using data grid view Here is the code I use for the table that does not have datetime attributes this code worked fine but for the table with "datetime" attributes it did not view sourceprint?



Dim sql As String = "select * from TableName"
Dim cmd1 As SQLiteCommand = New SQLiteCommand(sql, con)
Dim ds As New DataSet
Dim dt As New DataTable
Using con
Using cmd1
Using da As New SQLiteDataAdapter
da.SelectCommand = cmd1
da.Fill(ds)
dt = ds.Tables(0)
cmd1.Dispose()
End Using
End Using
End Using
datagridview.DataSource = ds.Tables(0
datagridview.Columns(0).HeaderText = "Header one"
datagridview.Columns(1).HeaderText = "Header two"
datagridview.Columns(2).HeaderText = "Header 3"


Thanks all for help


Aucun commentaire:

Enregistrer un commentaire