Greetings to everyone, I'm doing a support control system in VB.Net Community 2017
my database is SQLite
, the connection is fine and makes the perfect query and as I wish but when changing database I gives the following error:
System.FormatException: 'String was not recognized as a valid DateTime. '
In the other database, I only had a table with first and last names and when I wanted to use this new database with two new fields " fecha
and ceduladiario
", I presented the previous error.
I will post the code so that they understand me better, greetings and thanks for the help.
Imports System.Data.SQLite
Public Class Form1
Dim cadena As String = "Data Source=ControlDatos.db;Version=3;"
Dim conn As New SQLiteConnection
Dim dv As DataView
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
conn = New SQLiteConnection(cadena)
conn.Open()
Dim DA As New SQLiteDataAdapter("SELECT * FROM AsistenciaDiaria", conn)
Dim DT As New DataTable
DA.Fill(DT)
dv = DT.DefaultView
DataGridView1.DataSource = dv
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
conn = New SQLiteConnection(cadena)
Try
conn.Open()
MsgBox("conexion exitosa", MsgBoxStyle.Information, "CONECTADO")
Catch ex As Exception
MsgBox("no se pudo conectar por", ex.ToString)
End Try
End Sub
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
dv.RowFilter = "CEDULADIARIO like '%" & TextBox1.Text & "%'"
End Sub
End Class
NOTE: I do not use modules or classes, I'm doing everything from a form since it's a small system type agenda or something similar. Again, thanks for the help.