I have an application made on ASP.net that runs on Windows 2000 Server
In a form I have 2 inputs that receive dates, (Start Date and End Date)
When I make the respective query with the Initial and Final dates, if you return the result of the query, however, it shows me the following error message:
"Conversion from string DEF to type Date is not valid.".
I think that you are not making the correct conversions of what you receive in the variable dates
start = startdate.Text //Fecha Inicial
end1 = enddate.Text //Fecha Final
The result of the query shows it, but without taking into account these color configurations
Grid1.Rows(x).Cells(y).BackColor = Drawing.Color.Yellow
Grid1.Rows(x).Cells(y + 1).BackColor = Drawing.Color.Yellow
Grid1.Rows(x).Cells(y + 2).BackColor = Drawing.Color.Yellow
That is, it is not entering into these conditions; painting in yellow indicates that when an employee is given a LOW, he must show the record or the column with his employee's data in YELLOW color.
If (Grid1.Rows(x).Cells(y).Text.Substring(0, 3) = "BJA") Then
Grid1.Rows(x).Cells(y).BackColor = Drawing.Color.Yellow
Grid1.Rows(x).Cells(y + 1).BackColor = Drawing.Color.Yellow
Grid1.Rows(x).Cells(y + 2).BackColor = Drawing.Color.Yellow
Full Frontend of the application: ASP-NET Form
Part of the form
Fecha de Inicio <asp:TextBox ID="startdate" runat="server"></asp:TextBox><br /> <cc1:CalendarExtender ID="Calendar1" runat="server" TargetControlID="startdate"> </cc1:CalendarExtender> Fecha final <asp:TextBox ID="enddate" runat="server"></asp:TextBox> <cc1:CalendarExtender ID="Calendar2" runat="server" TargetControlID="enddate"> </cc1:CalendarExtender>
Backend of the application
Imports System.Data
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Dim a As Buayacorp.WebControls.DgToExcel
Dim dt As DataTable
Dim RowsCount As Integer = 10
Dim i As Integer
Dim start As Date
Dim end1 As Date
Dim dr As DataRow
Dim dataa As SqlDataAdapter
Dim datas As New DataSet
Dim reader As SqlDataReader
Dim fbaja As SqlDataReader
Dim DataSet As DataSet
Dim connString As New String("Data Source=000.000.00.00;User ID=ko;Password=12345678;initial catalog=bdd;")
Dim conn As New SqlConnection(connString)
Dim conn2 As New SqlConnection(connString)
Dim cmd As SqlCommand
Dim groupin As String
Dim aux As String
Dim aux2 As String
Dim aux3 As String
Dim sql As String
Dim flag As Integer = 0
Dim flag2 As Integer = 0
Public cont As Integer
Public group(24) As String
Private Function GetMyTable(ByVal TableName As String) As DataTable
dt = New DataTable(TableName)
start = Convert.ToDateTime("1 " & startdate.Text)
end1 = Convert.ToDateTime("1 " & enddate.Text)
flag = 1
While start <= end1
dt.Columns.Add(New DataColumn("ENTRADA:" & start, GetType(String)))
dt.Columns.Add(New DataColumn("SALIDA:" & start, GetType(String)))
dt.Columns.Add(New DataColumn("HORAS:" & start, GetType(Integer)))
aux = ""
aux = aux & " SELECT idclave,right(MIN(fechaEntrada),7) ENTRADA, "
aux = aux & " right(MAX(fechaSalida),7) SALIDA, "
aux = aux & " (datediff(n,min(fechaentrada)"
aux = aux & " ,max(fechasalida)))/60 HORAS"
aux = aux & " FROM(tblAsistencia)"
aux = aux & " WHERE(CONVERT(char(10),fechaEntrada, 101) = CONVERT(char(10), DATEADD(day, - " & flag & ",CONVERT(datetime, '" & end1 & "')), 101)) "
aux = aux & " group by idclave "
reader = data(aux)
reader.Read()
dr = dt.NewRow()
dr("ENTRADA:" & start) = reader.Item(2)
dr("SALIDA:" & start) = reader.Item(2)
dr("HORAS:" & start) = reader.Item(2)
start = DateAdd(DateInterval.Day, 1, start)
flag = flag + 1
End While
' dt.Rows.Add(dr)
Return dt
End Function
Public Sub ScriptError(ByVal m As String)
'Incluye el script para mostrar los errores en el cliente
Response.Write("<script language=""Javascript"">" & vbCrLf)
Response.Write("window.alert('" & m & "');")
Response.Write("history.back();")
Response.Write("</script>")
End Sub 'ScriptError()
Function data(ByVal str As String) As SqlDataReader
conn.Open()
cmd = New SqlCommand()
cmd.Connection = conn
cmd.CommandTimeout = 3000
cmd.CommandText = str
data = cmd.ExecuteReader
End Function
Function data2(ByVal str As String) As SqlDataReader
conn2.Open()
cmd = New SqlCommand()
cmd.Connection = conn2
cmd.CommandTimeout = 1000
cmd.CommandText = str
data2 = cmd.ExecuteReader
End Function
Public Function conecta(ByVal str As String) As DataSet
Try
dataa = New SqlDataAdapter(str, connString)
datas = New DataSet
dataa.Fill(datas)
conecta = datas
Catch
End Try
End Function
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
Dim aux As String
larea.DataTextField = "descripcion"
larea.DataValueField = "idarea"
larea.DataSource = conecta("select 0 as idarea,' Area' as descripcion union select idarea,descripcion from tblarea order by descripcion").Tables(0).DefaultView
larea.DataBind()
lturno.DataTextField = "descripcion"
lturno.DataValueField = "idturno"
lturno.DataSource = conecta("select 0 as idturno,' Turno' as descripcion union select idturno,descripcion from tblturno order by descripcion").Tables(0).DefaultView
lturno.DataBind()
ldepto.DataTextField = "descripcion"
ldepto.DataValueField = "idDEPTO"
ldepto.DataSource = conecta("select 0 as iddepto,' Depto' as descripcion union select iddEPto,descripcion from tbldepto order by descripcion").Tables(0).DefaultView
ldepto.DataBind()
aux = " select 0 as idclave,' Supervisor' as supervisor union select idclave,(nombre+' '+apellidos) as Supervisor from tblpersonal"
aux = aux & " where idclave in (select distinct fksupervisor from tblpersonal)"
aux = aux & " order by supervisor"
lsuper.DataTextField = "Supervisor"
lsuper.DataValueField = "idclave"
lsuper.DataSource = conecta(aux)
lsuper.DataBind()
End If
End Sub
Public Sub ScriptErrorAjax(ByVal mensaje As String)
Dim newlinea As String
newlinea = Environment.NewLine()
mensaje = mensaje.Replace("'", " ").ToString().Replace("""", "")
ScriptManager.RegisterStartupScript(Me.UpdatePanel1, GetType(String), "alertScript", "alert('" & mensaje.Replace(newlinea, "") & " ');", True)
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
If enddate.Text.Length = 0 Or startdate.Text.Length = 0 Then
ScriptErrorAjax("¡Ingrese la fecha de inicio y de fin por favor!!")
Return
End If
aux2 = ""
aux2 = aux2 & " SELECT DISTINCT personal.idclave, personal.Apellidos ,personal.Nombre ,"
aux2 = aux2 & " depto.descripcion AREA, area.descripcion BU,Puesto, turno.descripcion TURNO,"
aux2 = aux2 & " supervisor.apellidos + ' ' + supervisor.nombre SUPERVISOR,personal.fkstatus,isnull(lunes,0) as lunes,isnull(martes,0) as martes,isnull(miercoles,0) as miercoles,isnull(jueves,0) as jueves,isnull(viernes,0) as viernes,isnull(sabado,0) as sabado,isnull(domingo,0) as domingo FROM tbldescanso,tblPersonal personal, tblESDLog esd, "
aux2 = aux2 & " tbldepto Depto, tblarea area, tblusuario supervisor, tblturno turno,tblnomina nom "
aux2 = aux2 & " where(personal.fkdepto = depto.iddepto)"
aux2 = aux2 & " and nom.clave=personal.idclave and fksupervisor=supervisor.idclave and personal.idclave = tbldescanso.idclave and"
aux2 = aux2 & " fkarea=idarea and idturno=fkturno and "
If cbaja.Checked Then
aux2 = aux2 & " (fkstatus<>'1' or personal.idclave in"
aux2 = aux2 & " ("
aux2 = aux2 & " select empleado from tblpermisos where razon='BJA'"
aux2 = aux2 & " and fecha between (dateadd(dd,-30,(select getdate() ))) and (select getdate())"
aux2 = aux2 & " )"
aux2 = aux2 & ")"
Else
aux2 = aux2 & " (fkstatus<>'1')"
End If
If Lnomina.SelectedValue <> 0 Then
aux2 = aux2 & " and fktipo in ( " & Lnomina.SelectedValue & ")"
End If
If fknom.SelectedValue <> 0 Then
aux2 = aux2 & " and tipo in ( " & fknom.SelectedValue & ")"
End If
If txempleado.Text <> "" Then
aux2 = aux2 & " and personal.idclave=" & txempleado.Text
End If
If TXNOMBRE.Text <> "" Then
aux2 = aux2 & " and personal.nombre like '%" & TXNOMBRE.Text & "%'"
End If
If txapellido.Text <> "" Then
aux2 = aux2 & " and personal.apellidos like '%" & txapellido.Text & "%'"
End If
If Txpuesto.Text <> "" Then
aux2 = aux2 & " and personal.puesto like '%" & Txpuesto.Text & "%'"
End If
If larea.SelectedValue <> 0 Then
aux2 = aux2 & " and fkarea=" & larea.SelectedValue
End If
If lturno.SelectedValue <> 0 Then
aux2 = aux2 & " and fkturno=" & lturno.SelectedValue
End If
If lsuper.SelectedValue <> 0 Then
aux2 = aux2 & " and fksupervisor=" & lsuper.SelectedValue
End If
If ldepto.SelectedValue <> 0 Then
aux2 = aux2 & " and fkdepto=" & ldepto.SelectedValue
End If
start = startdate.Text
end1 = enddate.Text
flag = DateDiff(DateInterval.Day, start, end1)
flag2 = flag
Dim sel As String
While start <= end1
aux = ""
aux = aux & " select a.idclave,isnull(razon,entrada)ENTRADA,isnull(razon,salida) SALIDA,isnull(Horas,0)HORAS from ( "
aux = aux & " select p.idclave,b.entrada,b.salida,b.horas from (select distinct idclave from tblpersonal) p "
aux = aux & " left outer join ("
aux = aux & " SELECT idclave,right(MIN(fechaEntrada),7) ENTRADA,"
aux = aux & " right(MAX(fechaSalida),7) SALIDA, (datediff(n,min(fechaentrada), max(fechasalida)))/60 HORAS "
aux = aux & " FROM tblAsistencia WHERE(CONVERT(char(10),fechaEntrada, 101) = CONVERT(char(10), "
aux = aux & " DATEADD(day, -0,CONVERT(datetime, '" & start & "')), 101)) group by idclave ) b "
aux = aux & " on p.idclave=b.idclave ) a "
aux = aux & " left outer join "
aux = aux & " (select p.idclave,fecha,c.razon"
aux = aux & " from (select distinct idclave from tblpersonal) p "
aux = aux & " left outer join (select * from tblpermisos) c"
aux = aux & " on p.idclave=c.empleado"
aux = aux & " where CONVERT(char(10),fecha, 101) = CONVERT(char(10), DATEADD(day, -0,CONVERT(datetime, '" & Format(start, "yyyy-MM-dd") & "')), 101) "
aux = aux & " ) b on b.idclave=a.idclave "
sql = ""
If start <> end1 Then
aux3 = aux3 & ",[ENTRADA:" & start & "],"
aux3 = aux3 & "[SALIDA:" & start & "],"
aux3 = aux3 & "[HORAS:" & start & "]"
sql = sql & "select DATOS.*"
Else
sql = " Select datos.idclave,datos.apellidos,datos.nombre,datos.area,datos.bu,puesto,datos.turno,datos.supervisor,datos.fkstatus" & aux3
End If
sql = sql & " ,isnull(A.ENTRADA,case "
sql = sql & " when datepart(dw,'" & start & "')=2 and datos.lunes=1 then 'DESC'"
sql = sql & " when datepart(dw,'" & start & "')=3 and datos.martes=1 then 'DESC'"
sql = sql & " when datepart(dw,'" & start & "')=4 and datos.miercoles=1 then 'DESC'"
sql = sql & " when datepart(dw,'" & start & "')=5 and datos.jueves=1 then 'DESC'"
sql = sql & " when datepart(dw,'" & start & "')=6 and datos.viernes=1 then 'DESC'"
sql = sql & " when datepart(dw,'" & start & "')=7 and datos.sabado=1 then 'DESC'"
sql = sql & " when datepart(dw,'" & start & "')=1 and datos.domingo=1 then 'DESC'"
sql = sql & " else 'NOCHECO' end) AS 'ENTRADA:" & start & "'"
sql = sql & ",isnull(A.SALIDA,case "
sql = sql & " when datepart(dw,'" & start & "')=2 and datos.lunes=1 then 'DESC'"
sql = sql & " when datepart(dw,'" & start & "')=3 and datos.martes=1 then 'DESC'"
sql = sql & " when datepart(dw,'" & start & "')=4 and datos.miercoles=1 then 'DESC'"
sql = sql & " when datepart(dw,'" & start & "')=5 and datos.jueves=1 then 'DESC'"
sql = sql & " when datepart(dw,'" & start & "')=6 and datos.viernes=1 then 'DESC'"
sql = sql & " when datepart(dw,'" & start & "')=7 and datos.sabado=1 then 'DESC'"
sql = sql & " when datepart(dw,'" & start & "')=1 and datos.domingo=1 then 'DESC'"
sql = sql & " else 'NOCHECO' end) AS 'SALIDA:" & start & "',"
sql = sql & " isnull(A.HORAS,0) AS 'HORAS:" & start & "'"
sql = sql & " from ("
sql = sql & aux2
sql = sql & ")datos LEFT OUTER JOIN ("
sql = sql & aux
sql = sql & ") A ON DATOS.IDCLAVE=A.idclave "
aux2 = sql
flag = flag - 1
start = DateAdd(DateInterval.Day, 1, start)
End While
' dt = conecta(aux).Tables(0)
sql = sql
' Dim tabla As DataTable
'[ tabla = conecta(sql).Tables(0)
Grid1.Columns.Clear()
Grid1.DataSource = data(sql)
Grid1.DataBind()
conn.Close()
color(flag2)
Catch ex As Exception
ScriptErrorAjax(ex.Message)
End Try
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
excelexp()
End Sub
Sub color(ByVal z As Integer)
Dim x As Integer = 1
Dim y As Integer = 1
Dim a As Array
Dim b As String
Dim colore As Integer = 0
Dim pbaja As Date
Dim fact As Array
For x = 0 To Grid1.Rows.Count - 1
If (Grid1.Rows(x).Cells(8).Text = "1") Then
Grid1.Rows(x).BackColor = Drawing.Color.Yellow
fbaja = data2("select fecha from tblpermisos where razon = 'BJA' and empleado ='" & Grid1.Rows(x).Cells(0).Text & "'")
fbaja.Read()
pbaja = CDate(fbaja(0))
conn2.Close()
End If
For y = 9 To (z * 3) + 9 Step 3
If (Grid1.Rows(x).Cells(y).Text <> "NOCHECO") Then
a = (Grid1.Rows(x).Cells(y).Text).Substring(1, Grid1.Rows(x).Cells(y).Text.Length - 3).Split(":")
b = Grid1.Rows(x).Cells(y).Text
' If ((a(0) >= 6 And a(0) < 9) And Grid1.Rows(x).Cells(5).Text = "MATUTINO") Then
If (Grid1.Rows(x).Cells(y).Text = "VAC") _
Or (Grid1.Rows(x).Cells(y).Text.Substring(0, 3) = "PCG") _
Or (Grid1.Rows(x).Cells(y).Text.Substring(0, 3) = "PSG") _
Or (Grid1.Rows(x).Cells(y).Text.Substring(0, 3) = "SUS") _
Or (Grid1.Rows(x).Cells(y).Text.Substring(0, 3) = "INC") _
Or (Grid1.Rows(x).Cells(y).Text.Substring(0, 3) = "DES") _
Or (Grid1.Rows(x).Cells(y).Text.Substring(0, 3) = "COM") _
Or (Grid1.Rows(x).Cells(y).Text.Substring(0, 3) = "BJA") _
Or (Grid1.Rows(x).Cells(y).Text.Substring(0, 3) = "BAJ") Then
If (Grid1.Rows(x).Cells(y).Text.Substring(0, 3) <> "BJA") Then
Grid1.Rows(x).Cells(y).BackColor = Drawing.Color.White
Grid1.Rows(x).Cells(y + 1).BackColor = Drawing.Color.White
Grid1.Rows(x).Cells(y + 2).BackColor = Drawing.Color.White
End If
' Grid1.Rows(x).Cells(y).BackColor = Drawing.Color.LightGreen
' Grid1.Rows(x).Cells(y + 1).BackColor = Drawing.Color.LightGreen
' Grid1.Rows(x).Cells(y + 2).BackColor = Drawing.Color.LightGreen
Else
If (Grid1.Rows(x).Cells(y).Text.Substring(0, 3) <> "FTA") Then
If (CDate(b) >= CDate("6:01AM") And CDate(b) < CDate("12:00PM")) And ((Grid1.Rows(x).Cells(6).Text = "MATUTINO") Or (Grid1.Rows(x).Cells(6).Text = "ESPECIAL 8") Or (Grid1.Rows(x).Cells(6).Text = "ESPECIAL 9")) Then
Grid1.Rows(x).Cells(y).BackColor = Drawing.Color.LightCoral
Grid1.Rows(x).Cells(y + 1).BackColor = Drawing.Color.LightCoral
Grid1.Rows(x).Cells(y + 2).BackColor = Drawing.Color.LightCoral
ElseIf (CDate(b) >= CDate("12:01PM") Or CDate(b) < CDate("5:00AM")) And (Grid1.Rows(x).Cells(6).Text = "MATUTINO") Then
' Grid1.Rows(x).Cells(y).BackColor = Drawing.Color.LightBlue
' Grid1.Rows(x).Cells(y + 1).BackColor = Drawing.Color.LightBlue
' Grid1.Rows(x).Cells(y + 2).BackColor = Drawing.Color.LightBlue
ElseIf (CDate(b) >= CDate("2:01PM") And CDate(b) < CDate("6:00PM")) And (Grid1.Rows(x).Cells(6).Text = "VESPERTINO") Then
Grid1.Rows(x).Cells(y).BackColor = Drawing.Color.LightCoral
Grid1.Rows(x).Cells(y + 1).BackColor = Drawing.Color.LightCoral
Grid1.Rows(x).Cells(y + 2).BackColor = Drawing.Color.LightCoral
ElseIf (CDate(b) >= CDate("6:01PM") Or CDate(b) < CDate("1:00PM")) And ((Grid1.Rows(x).Cells(6).Text = "VESPERTINO") Or (Grid1.Rows(x).Cells(5).Text = "ESPECIAL 10") Or (Grid1.Rows(x).Cells(5).Text = "ESPECIAL 11")) Then
Grid1.Rows(x).Cells(y).BackColor = Drawing.Color.LightCoral
Grid1.Rows(x).Cells(y + 1).BackColor = Drawing.Color.LightCoral
Grid1.Rows(x).Cells(y + 2).BackColor = Drawing.Color.LightCoral
ElseIf (CDate(b) >= CDate("9:31PM") And CDate(b) < CDate("11:59PM")) And (Grid1.Rows(x).Cells(6).Text = "NOCTURNO") Then
Grid1.Rows(x).Cells(y).BackColor = Drawing.Color.LightCoral
Grid1.Rows(x).Cells(y + 1).BackColor = Drawing.Color.LightCoral
Grid1.Rows(x).Cells(y + 2).BackColor = Drawing.Color.LightCoral
ElseIf (CDate(b) < CDate("8:01PM")) And (Grid1.Rows(x).Cells(6).Text = "NOCTURNO") Then
'Grid1.Rows(x).Cells(y).BackColor = Drawing.Color.LightBlue
' Grid1.Rows(x).Cells(y + 1).BackColor = Drawing.Color.LightBlue
' Grid1.Rows(x).Cells(y + 2).BackColor = Drawing.Color.LightBlue
End If
Else
Grid1.Rows(x).Cells(y).BackColor = Drawing.Color.LightCoral
Grid1.Rows(x).Cells(y + 1).BackColor = Drawing.Color.LightCoral
Grid1.Rows(x).Cells(y + 2).BackColor = Drawing.Color.LightCoral
End If
End If
If (Grid1.Rows(x).Cells(8).Text = "1") Then
fact = Grid1.HeaderRow.Cells(y).Text.Split(":")
If (pbaja <= CDate(fact(1))) And ( _
(Grid1.Rows(x).Cells(y).Text = "VAC") _
Or (Grid1.Rows(x).Cells(y).Text.Substring(0, 3) = "PCG") _
Or (Grid1.Rows(x).Cells(y).Text.Substring(0, 3) = "PSG") _
Or (Grid1.Rows(x).Cells(y).Text.Substring(0, 3) = "SUS") _
Or (Grid1.Rows(x).Cells(y).Text.Substring(0, 3) = "INC") _
Or (Grid1.Rows(x).Cells(y).Text.Substring(0, 3) = "DES") _
Or (Grid1.Rows(x).Cells(y).Text.Substring(0, 3) = "COM")) Then
Grid1.Rows(x).Cells(y).Text = "BAJA"
Grid1.Rows(x).Cells(y + 1).Text = "BAJA"
Grid1.Rows(x).Cells(y).BackColor = Drawing.Color.Yellow
Grid1.Rows(x).Cells(y + 1).BackColor = Drawing.Color.Yellow
Grid1.Rows(x).Cells(y + 2).BackColor = Drawing.Color.Yellow
Else
If (Grid1.Rows(x).Cells(y).Text.Substring(0, 3) = "BJA") Then
Grid1.Rows(x).Cells(y).BackColor = Drawing.Color.Yellow
Grid1.Rows(x).Cells(y + 1).BackColor = Drawing.Color.Yellow
Grid1.Rows(x).Cells(y + 2).BackColor = Drawing.Color.Yellow
Else
Grid1.Rows(x).Cells(y).BackColor = Drawing.Color.LightCoral
Grid1.Rows(x).Cells(y + 1).BackColor = Drawing.Color.LightCoral
Grid1.Rows(x).Cells(y + 2).BackColor = Drawing.Color.LightCoral
End If
End If
End If
Else
If (Grid1.Rows(x).Cells(8).Text = "1") Then
fact = Grid1.HeaderRow.Cells(y).Text.Split(":")
If pbaja <= CDate(fact(1)) Then
Grid1.Rows(x).Cells(y).Text = "BAJA"
Grid1.Rows(x).Cells(y + 1).Text = "BAJA"
Grid1.Rows(x).Cells(y).BackColor = Drawing.Color.Yellow
Grid1.Rows(x).Cells(y + 1).BackColor = Drawing.Color.Yellow
Grid1.Rows(x).Cells(y + 2).BackColor = Drawing.Color.Yellow
Else
Grid1.Rows(x).Cells(y).BackColor = Drawing.Color.LightCoral
Grid1.Rows(x).Cells(y + 1).BackColor = Drawing.Color.LightCoral
Grid1.Rows(x).Cells(y + 2).BackColor = Drawing.Color.LightCoral
End If
Else
Grid1.Rows(x).Cells(y).BackColor = Drawing.Color.LightCoral
Grid1.Rows(x).Cells(y + 1).BackColor = Drawing.Color.LightCoral
Grid1.Rows(x).Cells(y + 2).BackColor = Drawing.Color.LightCoral
End If
End If
Next
Next
End Sub
Sub excelexp()
Dim sb As StringBuilder = New StringBuilder()
Dim SW As System.IO.StringWriter = New System.IO.StringWriter(sb)
Dim htw As HtmlTextWriter = New HtmlTextWriter(SW)
Dim Page As Page = New Page()
Dim form As HtmlForm = New HtmlForm()
Grid1.EnableViewState = False
Page.EnableEventValidation = False
Page.DesignerInitialize()
Page.Controls.Add(form)
form.Controls.Add(Grid1)
Page.RenderControl(htw)
Response.Clear()
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("Content-Disposition", "attachment;filename=asistencia.xls")
Response.Charset = "UTF-8″"
Response.ContentEncoding = Encoding.Default
Response.Write(sb.ToString())
Response.End()
End Sub
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
txempleado.Text = ""
TXNOMBRE.Text = ""
txapellido.Text = ""
startdate.Text = ""
enddate.Text = ""
lsuper.SelectedValue = 0
larea.SelectedValue = 0
lturno.SelectedValue = 0
ldepto.SelectedValue = 0
Grid1.DataSource = ""
Grid1.DataBind()
End Sub
End Class