ASP.NET - ayuda data time

 
Vista:

ayuda data time

Publicado por ohpluc (3 intervenciones) el 16/02/2011 23:23:35
hola que tal estoi haciendo un pequeño sistemita pero tengo un pequeño problema me sale este error , error de sintaxis al convertir una cadena de caracters a datatime

este es mi codigo

Imports System.Data.SqlClient
Imports System.Data
Partial Class Default2
Inherits System.Web.UI.Page
Private SQLSERVER_CONNECTIONSTRING_ADMON As String

Public Function GetConnectionString_admon() As String
SQLSERVER_CONNECTIONSTRING_ADMON = "Data Source=PROVIH;Initial Catalog=bd_personal;User ID=sa"
Return SQLSERVER_CONNECTIONSTRING_ADMON
End Function

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim cve_personal As String
Dim cve_area As String
Dim ln_status As String

Dim sql As String
Dim mycmd As New SqlCommand
Dim reader As SqlDataReader
Dim coneccion As New SqlConnection(GetConnectionString_admon())
coneccion.Open()

cve_personal = DropDownList1.SelectedValue
cve_area = DropDownList2.SelectedValue

If RadioButtonList1.SelectedValue = "Tramite" Then
ln_status = "PERSONAL"
Else
ln_status = "OFICIAL"
End If

Try
coneccion.BeginTransaction.Commit()
sql = "INSERT INTO det_salida (cve_detsalida,fecha_salida, cve_personal, cve_area, motivo_salida, lugar_salida, hora_salida ,hora_entrada ,cve_status,motivo_cancel,idUser,fecha_captura) VALUES ('" + fecha_salida.Text + "','" + cve_personal + "','" + cve_area + "','" + ln_status + "','" + txt_lsalida.Text + "','" + lb_hsalida.Text + "','" + h_entrada.Text + "','" + ln_status + "','" + cve_status.Text + "','" + motivo_cancel.Text + "','" + txt_clave.Text + "','" + fecha_captura.Text + "' )"
mycmd.CommandText = sql
mycmd.Connection = coneccion
reader = mycmd.ExecuteReader
reader.Close()

Catch ex As Exception
MsgBox(ex.Message)
End Try
coneccion.Close()

End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

lb_hsalida2.Text = Date.Now.ToLongTimeString

End Sub

Protected Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Calendar1.SelectionChanged
fecha_salida.Text = Format(Calendar1.SelectedDate)
End Sub

End Class
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder