D
David Fúnez
Hi;
I'm working with SQ CE, i can insert data in a datetime field, this is the
code:
' This code works fine
'----------------------
cn = New SqlCeConnection("Data Source=\program files\sistema\zafra.sdf")
cn.Open()
Dim cmd As SqlCeCommand = cn.CreateCommand
Dim truck As String
Dim fec As Date
Dim lot, car As Integer
truck = Me.txtCamion.Text
fec = Me.txtFecha.Text
lot = Me.txtLote.Text
car = Me.txtCargas.Text
' Agregamos registro
cmd.CommandText = "INSERT INTO colecta" & _
"(lote, fecha, camion, cargas)" & _
" VALUES (?, ?, ?, ?)"
cmd.Parameters.Add("@lote", lot)
cmd.Parameters.Add("@fecha", fec)
cmd.Parameters.Add("@camion", truck)
cmd.Parameters.Add("@cargas", car)
cmd.Prepare()
cmd.ExecuteNonQuery()
*** The UPDATE Code, it launches this error "Data Conversion Failed [OLE DB
status value,,,,,]"
*** the problem is with the DATE value, so i don't know how to fix it.
Dim cn As SqlCeConnection
cn = New SqlCeConnection("Data Source=\Program Files\sistema\zafra.sdf")
cn.Open()
Dim cmd As SqlCeCommand = cn.CreateCommand
Dim truck As String
Dim fec As Date
Dim lot, car As Integer
truck = Me.txtCamion.Text
fec = Me.txtFecha.Text
lot = Me.txtLote.Text
car = Me.txtCargas.Text
' Actualizamos registro
cmd.CommandText = _
"UPDATE colecta SET fecha=?, camion=?, cargas=? WHERE lote=?"
cmd.Parameters.Add(New SqlCeParameter("@lote", truck))
cmd.Parameters.Add(New SqlCeParameter("@fecha", fec))
cmd.Parameters.Add(New SqlCeParameter("@camion", lot))
cmd.Parameters.Add(New SqlCeParameter("@cargas", car))
cmd.Prepare()
cmd.ExecuteNonQuery()
***************************************
Thanks on advance.
I'm working with SQ CE, i can insert data in a datetime field, this is the
code:
' This code works fine
'----------------------
cn = New SqlCeConnection("Data Source=\program files\sistema\zafra.sdf")
cn.Open()
Dim cmd As SqlCeCommand = cn.CreateCommand
Dim truck As String
Dim fec As Date
Dim lot, car As Integer
truck = Me.txtCamion.Text
fec = Me.txtFecha.Text
lot = Me.txtLote.Text
car = Me.txtCargas.Text
' Agregamos registro
cmd.CommandText = "INSERT INTO colecta" & _
"(lote, fecha, camion, cargas)" & _
" VALUES (?, ?, ?, ?)"
cmd.Parameters.Add("@lote", lot)
cmd.Parameters.Add("@fecha", fec)
cmd.Parameters.Add("@camion", truck)
cmd.Parameters.Add("@cargas", car)
cmd.Prepare()
cmd.ExecuteNonQuery()
*** The UPDATE Code, it launches this error "Data Conversion Failed [OLE DB
status value,,,,,]"
*** the problem is with the DATE value, so i don't know how to fix it.
Dim cn As SqlCeConnection
cn = New SqlCeConnection("Data Source=\Program Files\sistema\zafra.sdf")
cn.Open()
Dim cmd As SqlCeCommand = cn.CreateCommand
Dim truck As String
Dim fec As Date
Dim lot, car As Integer
truck = Me.txtCamion.Text
fec = Me.txtFecha.Text
lot = Me.txtLote.Text
car = Me.txtCargas.Text
' Actualizamos registro
cmd.CommandText = _
"UPDATE colecta SET fecha=?, camion=?, cargas=? WHERE lote=?"
cmd.Parameters.Add(New SqlCeParameter("@lote", truck))
cmd.Parameters.Add(New SqlCeParameter("@fecha", fec))
cmd.Parameters.Add(New SqlCeParameter("@camion", lot))
cmd.Parameters.Add(New SqlCeParameter("@cargas", car))
cmd.Prepare()
cmd.ExecuteNonQuery()
***************************************
Thanks on advance.