
05/05/2005, 14:23
|
| | Fecha de Ingreso: junio-2002
Mensajes: 212
Antigüedad: 22 años, 8 meses Puntos: 0 | |
En xp anda y en 98 tira error Hola tengo este codigo que em crea un html a partir de una base de datos access:
Código:
Private Sub lclickb(ByVal sender As Object, ByVal e As EventArgs) '' handles Button1.click, button2.click
On Error GoTo errores
galeria = False
Const PAGE_SIZE = 10
Panel9.Visible = False
Panel7.Visible = False
Panel6.Visible = True
If MasterConn2.State = 1 Then
MasterConn2.Close()
End If
If fotoConn.State = 1 Then
fotoConn.Close()
End If
If audioConn.State = 1 Then
audioConn.Close()
End If
If videoConn.State = 1 Then
videoConn.Close()
End If
TextBox4.Text = "Buscar"
ComboBox2.SelectedIndex = 0
buscar = False
Panel7.Visible = False
viendo = False
ComboBox1.Enabled = True
Dim l As cControls.cButton = CType(sender, cControls.cButton)
botonnombre = l.Text
pagina = 1
FileOpen(1, Application.StartupPath & "\nav.tmp", OpenMode.Output)
Print(1, "<html>" & vbCrLf)
Print(1, "<head>" & vbCrLf)
Print(1, "<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>" & vbCrLf)
Print(1, "</head>" & vbCrLf)
Print(1, "<body bgcolor='f9f9f9' text='#000000'>" & vbCrLf)
Print(1, "<div align='center'><font color='#CC0000' size='4'><b>" & l.Text)
Print(1, "</b></font></div>" & vbCrLf)
botonid = l.Tag
MasterConn.ConnectionString = MasterAccessConnect
MasterConn.Open(MasterAccessConnect)
MasterRs = New ADODB.Recordset
MasterRs.Open("SELECT * FROM noticias where idcategoria=" & l.Tag, MasterConn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic)
Dim totalrs As Integer
totalrs = MasterRs.RecordCount
MasterConn.Close()
MasterConn.ConnectionString = MasterAccessConnect
MasterConn.Open(MasterAccessConnect)
MasterRs = New ADODB.Recordset
MasterRs.LockType = ADODB.LockTypeEnum.adLockOptimistic
MasterRs.CursorLocation = ADODB.CursorLocationEnum.adUseClient
MasterRs.Open("SELECT * FROM noticias where idcategoria=" & l.Tag & " order by fecha desc", MasterConn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic)
totalpaginas = MasterRs.PageCount
'' ComboBox1.Text = 1
ComboBox1.Items.Clear()
Dim xx As Int16
For xx = 1 To totalpaginas
ComboBox1.Items.Add(xx)
Next xx
If totalpaginas > 0 Then
ComboBox1.SelectedIndex = pagina - 1
Else
ComboBox1.Items.Add("1")
ComboBox1.SelectedIndex = 0
GoTo sinresultados
End If
MasterRs.AbsolutePage = pagina
Dim i As Integer
i = 0
''MasterRs.AbsolutePage =
Do Until MasterRs.EOF Or MasterRs.BOF Or i = PAGE_SIZE
i = i + 1
'' MsgBox(MasterRs.Fields.Item("titulo").Value)
Print(1, "<table width='100%' border='0'>" & vbCrLf)
Print(1, "<tr> " & vbCrLf)
Print(1, "<td><b><font face='Verdana, Arial, Helvetica, sans-serif' size='2'>" & MasterRs.Fields.Item("titulo").Value & vbCrLf)
Print(1, "</font></b>" & vbCrLf)
fotoConn.ConnectionString = fotoAccessConnect
fotoConn.Open(fotoAccessConnect)
fotoRs = New ADODB.Recordset
fotoRs.Open("SELECT * FROM fotos where idnoticia='" & MasterRs.Fields.Item("idnoticia").Value & "'", fotoConn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic)
If fotoRs.RecordCount > 0 Then
Print(1, " <img src='foto16.gif' width='16' height='16' border='0' alt='Noticia Contiene Fotos'>" & vbCrLf)
End If
fotoConn.Close()
If audioConn.State = 1 Then
audioConn.Close()
End If
audioConn.ConnectionString = audioAccessConnect
audioConn.Open(audioAccessConnect)
audioRs = New ADODB.Recordset
audioRs.Open("SELECT * FROM audio where idnoticia='" & MasterRs.Fields.Item("idnoticia").Value & "'", audioConn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic)
If audioRs.RecordCount > 0 Then
Print(1, "<img src='audio16.gif' width='16' height='16' border='0' alt='Noticia Contiene Audio'> " & vbCrLf)
End If
audioRs.Close()
If videoConn.State = 1 Then
videoConn.Close()
End If
videoConn.ConnectionString = videoAccessConnect
videoConn.Open(videoAccessConnect)
videoRs = New ADODB.Recordset
videoRs.Open("SELECT * FROM video where idnoticia='" & MasterRs.Fields.Item("idnoticia").Value & "'", videoConn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic)
If videoRs.RecordCount > 0 Then
Print(1, "<img src='video16.gif' width='16' height='16' border='0' alt='Noticia Contiene Video'>" & vbCrLf)
End If
videoConn.Close()
Print(1, "</td></tr>" & vbCrLf)
Print(1, "<tr> " & vbCrLf)
Print(1, "<td><font face='Arial, Helvetica, sans-serif' size='1'>(" & Format(MasterRs.Fields.Item("fecha").Value, "dd MMMM yyyy") & ")" & vbCrLf)
Print(1, "</font></td>" & vbCrLf)
Print(1, "</tr>" & vbCrLf)
Print(1, "<tr> " & vbCrLf)
Print(1, "<td><font face='Verdana, Arial, Helvetica, sans-serif' size='1'>" & MasterRs.Fields.Item("copete").Value & vbCrLf)
Print(1, "</font><br><a href='" & MasterRs.Fields.Item("idnoticia").Value & "'><img src='leer.gif' border='0'></a> </td>" & vbCrLf)
Print(1, "</tr>" & vbCrLf)
Print(1, "</table>" & vbCrLf)
Print(1, "<hr>" & vbCrLf)
MasterRs.MoveNext()
Loop
Print(1, " </body>" & vbCrLf)
Print(1, "</html>" & vbCrLf)
FileClose(1)
wb.Navigate(Application.StartupPath & "\nav.tmp")
'' MsgBox(i)
Label6.Text = "Página: " & pagina & " de " & totalpaginas
'' MsgBox(MasterRs.)
MasterConn.Close()
Panel6.Visible = True
Exit Sub
sinresultados:
MasterConn.Close()
ComboBox1.Enabled = False
Print(1, "<table width='100%' border='0'>" & vbCrLf)
Print(1, "<tr> " & vbCrLf)
Print(1, "<td><b><br><div align='center'><font face='Verdana, Arial, Helvetica, sans-serif' size='2'>¡No hay ninguna noticia ingresada en esta sección!" & vbCrLf)
Print(1, "</font></div></b></td>" & vbCrLf)
Print(1, "</tr>" & vbCrLf)
Print(1, "</table>" & vbCrLf)
Print(1, " </body>" & vbCrLf)
Print(1, "</html>" & vbCrLf)
FileClose(1)
wb.Navigate(Application.StartupPath & "\nav.tmp")
'' MsgBox(i)
Label6.Text = "Página: 1 de 1" ''& totalpaginas
Panel6.Visible = True
Exit Sub
errores:
Panel6.Visible = True
If MasterConn2.State = 1 Then
MasterConn2.Close()
End If
If MasterConn.State = 1 Then
MasterConn.Close()
End If
If fotoConn.State = 1 Then
fotoConn.Close()
End If
If audioConn.State = 1 Then
audioConn.Close()
End If
If videoConn.State = 1 Then
videoConn.Close()
End If
FileClose(1)
'' Return
MsgBox(Err.Description)
Err.Clear()
End Sub
El tema es que en xp este codigo anda barbaro pero en 98 con la misma base de datos MDAC 2.8 instalado y el mismo ejecutable me dice que o se borro el registro o EOF=true pero en XP nada, me muestra todo barbaro...
Alguien me peude explicar que sucede y como lo arreglo? porque la verdad se me acabaron las maldiciones permitidas para 1 solo programa :D
Gracias
__________________ Simuladores y Examenes Cisco, Herramientas de Red Online - Tecnologia y Redes |