cuando en el asunto poseen un caracter especial por ejemplo @#$ los correos no salen y no te muestra ningun correo de rebote, especialmente cuando se envian a gmail.
reenviar con otro nombre sin los caracteres. porque los ve como spam
cuando en el asunto poseen un caracter especial por ejemplo @#$ los correos no salen y no te muestra ningun correo de rebote, especialmente cuando se envian a gmail.
reenviar con otro nombre sin los caracteres. porque los ve como spam
Imports DevExpress.XtraPrintingLinks
Imports DevExpress.XtraGrid
Imports DevExpress.XtraPrinting
Private Sub cmdExcel_Click(sender As Object, e As EventArgs) Handles cmdExcel.Click
Me.Cursor = Cursors.WaitCursor
Try
Using SFD As SaveFileDialog = GetExcelSaveFileDialog()
If (SFD.ShowDialog(Me) = DialogResult.OK) Then
Dim ps As New PrintingSystem
Dim CompositeLink As New DevExpress.XtraPrintingLinks.CompositeLink
CompositeLink.PrintingSystem = ps
'con este metodo podemos exportar varias grillas mas no data grid view.
declaramos un vector y asignamos las grillas necesarias.
Dim lgc() As DevExpress.XtraGrid.GridControl = {gc_ventas, gridVacia, gc_Stock, gridVacia, gc_0kmAsignado, gridVacia, gc_0kmS_Asignar, gridVacia, gc_TTVU}
For i As Integer = 0 To lgc.Length - 1
Dim link As New PrintableComponentLink
link.Component = lgc(i)
CompositeLink.Links.Add(link)
Next
CompositeLink.ExportToXls(SFD.FileName)
End If
End Using
Me.Cursor = Cursors.Default
Catch ex As Exception
XtraMessageBox.Show("" & ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End Try
Private Sub te_cuil_Leave(sender As Object, e As EventArgs) Handles Txt_Cuil.Leave
If Txt_Cuil.Text <> "" Then
Dim a(11) As Integer, n As Single
'cargo en la matriz de izquierda a derecha los numeros correspondientes
'al cuit ingresado en text1.text sin los guiones suponiendo
'que el cuit o cuil sea = 30-50052945-4
a(1) = CInt(Mid(Txt_Cuil.Text, 1, 1)) '= 3
a(2) = CInt(Mid(Txt_Cuil.Text, 2, 1)) '= 0
a(3) = CInt(Mid(Txt_Cuil.Text, 4, 1)) '= 5
a(4) = CInt(Mid(Txt_Cuil.Text, 5, 1)) '= 0
a(5) = CInt(Mid(Txt_Cuil.Text, 6, 1)) '= 0
a(6) = CInt(Mid(Txt_Cuil.Text, 7, 1)) '= 5
a(7) = CInt(Mid(Txt_Cuil.Text, 8, 1)) '= 2
a(8) = CInt(Mid(Txt_Cuil.Text, 9, 1)) '= 9
a(9) = CInt(Mid(Txt_Cuil.Text, 10, 1)) '= 4
a(10) = CInt(Mid(Txt_Cuil.Text, 11, 1)) '= 5
a(11) = CInt(Mid(Txt_Cuil.Text, 13, 1)) '= 4
'calculo el digito verificador
n = (a(1) * 6) + (a(2) * 7) + (a(3) * 8) + (a(4) * 9) + (a(5) * 4) + (a(6) * 5) + (a(7) * 6) + (a(8) * 7) + (a(9) * 8) + (a(10) * 9)
n = ((n / 11) - Int(n / 11)) * 11
'el valor de n tiene que ser = a a(11) es decir 4 o el cuit esta mal
If n = a(11) Then
Else
XtraMessageBox.Show("El cuil es incorrecto", "Error al ingresar el Cuil", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
Else
XtraMessageBox.Show("Debe Ingresar el Cuil", "", MessageBoxButtons.OK, MessageBoxIcon.Error)
Txt_Cuil.Focus()
End If
End Sub
---------------------------------------------------------------------------------------------------------
Public Shared Function NumeroCuit(ByVal numero As String) As Boolean
Dim iSuma As Integer = 0
Dim bValidado As Boolean = False
numero = numero.Replace("-", "")
If IsNumeric(numero) Then
If CLng(numero) <= 0 Then Return False
If numero.Length <> 11 Then
Return False
Else
Dim inicio As Integer = CInt(numero.Substring(0, 2))
If inicio <> 20 And inicio <> 23 And inicio <> 24 And inicio <> 27 _
And inicio <> 30 And inicio <> 33 Then Return False
iSuma += CInt(numero.Substring(0, 1)) * 5
iSuma += CInt(numero.Substring(1, 1)) * 4
iSuma += CInt(numero.Substring(2, 1)) * 3
iSuma += CInt(numero.Substring(3, 1)) * 2
iSuma += CInt(numero.Substring(4, 1)) * 7
iSuma += CInt(numero.Substring(5, 1)) * 6
iSuma += CInt(numero.Substring(6, 1)) * 5
iSuma += CInt(numero.Substring(7, 1)) * 4
iSuma += CInt(numero.Substring(8, 1)) * 3
iSuma += CInt(numero.Substring(9, 1)) * 2
iSuma += CInt(numero.Substring(10, 1)) * 1
End If
If Math.Round(iSuma / 11, 0) = (iSuma / 11) Then
bValidado = True
End If
End If
Return bValidado
End Function
En el trabajo he tenido que modificar el modelo de una base de datos MySQL para un proyecto ya casi terminado (benditos lusers que no saben cómo hacen lo que hacen), por lo que creé un par de procedimientos almacenados. En mi equipo funcionaban perfectamente, pero al probarlo en otro no hacía más que mostrar el error:
ERROR 1267 (HY000): Illegal mix of collations (utf8_spanish_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '='
El único punto del procedimiento donde podía ocurrir era en un where donde se comparaban dos longtext:
select id into errorid from errortecnico
where mensaje = errormensaje
Buscando y buscando encontré la inspiración en el blog de Pablo Viquez, un desarrollador de Costa Rica, con la única diferencia de que su problema ocurría con la codificación latin1.
La solución es convertir la parte del where que causa problemas a la collation (dentro de una codificación, la ordenación de caracteres) que nosotros usamos mediante la sentencia convert, que en mi caso quedaría tal que así:
select id into errorid from errortecnico where mensaje
= CONVERT(errormensaje using utf8) collate utf8_spanish_ci
Con esto, MySQL convertirá automáticamente el dato que interpretaba como utf8_general_ci a utf8_spanish_ci.
tomado de: https://arklad.wordpress.com/2010/03/23/illegal-mix-of-collations-en-procedimiento-almacenado-de-mysql/
SELECT EXISTS(SELECT 1 FROM mysql.proc p WHERE db = 'db_name' AND name = 'stored_proc_name');
por lo que podría hacer:
IF NOT EXISTS(SELECT 1 FROM mysql.proc p WHERE db = 'db_name' AND name = 'stored_proc_name') THEN
....
END IF;
DELIMITER $$
Observacion: Quiero dispara un registro log en la tbl t_turno_log despues que en la tbl t_turnos de la bd turnos, se registre un nuevo turno.
USE `turnos`$$
DROP TRIGGER /*!50032 IF EXISTS */ `automatico`$$
CREATE
/*!50017 DEFINER = 'root'@'localhost' */
TRIGGER `automatico` AFTER INSERT ON `t_turno`
FOR EACH ROW BEGIN
INSERT INTO `turnos`.`t_turno_log`(`codigo`,`descripcion`,`fecha`,`usuario`)
VALUES(NULL,'Se ingreso un nuevo turno.',CURRENT_TIMESTAMP,1);
END;
$$
DELIMITER ;
Se crea una tabla con dos campos donde el primero tenga el mismo orden de la consulta que quieres ordenar, y el segundo campo lo colocamos con el orden deseado
ejemplo: Script
necesitamos ordenar un resultado de la forma siguiente:
1,2,3,4,5,6,7,8,10,11,12,9
con el nueve al final de todo.
pasos 1
creamos la tabla que va forzar el orden
CREATE TABLE ORDENADOR_EQUIVALENTE
(numero VARCHAR(10),
valor VARCHAR(10)
)
insertamos los datos:
campo número esta ordenado y tiene los mismo de la consulta.
campo valor esta ordenado como vos queres y con letras.
INSERT INTO ORDENADOR_EQUIVALENTE VALUES( '01','a')
INSERT INTO ORDENADOR_EQUIVALENTE VALUES( '02','b')
INSERT INTO ORDENADOR_EQUIVALENTE VALUES( '03','c')
INSERT INTO ORDENADOR_EQUIVALENTE VALUES( '04','d')
INSERT INTO ORDENADOR_EQUIVALENTE VALUES( '05','e')
INSERT INTO ORDENADOR_EQUIVALENTE VALUES( '06','f')
INSERT INTO ORDENADOR_EQUIVALENTE VALUES( '07','g')
INSERT INTO ORDENADOR_EQUIVALENTE VALUES( '08','h')
INSERT INTO ORDENADOR_EQUIVALENTE VALUES( '09','l')
INSERT INTO ORDENADOR_EQUIVALENTE VALUES( '10','i')
INSERT INTO ORDENADOR_EQUIVALENTE VALUES( '11','j')
INSERT INTO ORDENADOR_EQUIVALENTE VALUES( '12','k')
solo debemos relacionarla en el lugar presiso y que sea el campo numero el que se relacione
ej.
INNER JOIN ORDENADOR_EQUIVALENTE OE ON OE.numero = MAESTRA.IDESTADOHDR
y el campo valor el que ordene en la clausu:
ej.
ORDER BY OE.valor ASC,HIS.TS desc
listo.
----CREAMOS LA TABLA TEMPORAL
-- CREATE TABLE #temporal( IdPedidoDetalle BIGINT,IdPedido bigint,IdArt bigint,IdColor bigint ,IdTalle bigint,Cantidad int,Precio int,Ts datetime)
-- INSERT INTO #temporal
--SELECT IdPedidoDetalle, IdPedido, IdArt, IdColor, IdTalle, Cantidad, Precio, Ts FROM RDSAWSSQL.CATALOGO.dbo.SIGMA_CATALOGO_PEDIDO_DETALLES AS scpd WITH (NOLOCK) WHERE SCPD.ts BETWEEN @FDESDE AND @FHASTA
--------------------------------
--CREATE TABLE #temporal_cambio (IdPedidoDetalleCambio BIGINT,IdPedido bigint,IdArt bigint,IdColor bigint ,IdTalle bigint,Cantidad int,Ts datetime)
-- INSERT INTO #temporal_cambio
--SELECT IdPedidoDetalleCambio,IdPedido,IdArt,IdColor,IdTalle,Cantidad,Ts FROM RDSAWSSQL.CATALOGO.dbo.SIGMA_CATALOGO_PEDIDO_DETALLES_CAMBIOS AS d WITH (NOLOCK) WHERE ts > @fdesde
------
--CREATE TABLE #TEMPORAL_CABECERA
-- ( IdPedido bigint ,IdCliente bigint ,IdToken int,IdEstado int,TipoCompra varchar(100),QuienRetira varchar(400),QuienRecibe varchar(400),Observaciones varchar(400),CodigoEnvio varchar(500),FechaAlta datetime
-- ,Ts datetime,NroFactura varchar(200),Operacion varchar(200),ObservacionesVendedor varchar(max),EsResolucion int,IdDireccion bigint)
--INSERT into #TEMPORAL_CABECERA
--SELECT IdPedido,IdCliente,IdToken,IdEstado,TipoCompra,QuienRetira,QuienRecibe,Observaciones,CodigoEnvio,FechaAlta,Ts,NroFactura,Operacion,ObservacionesVendedor,EsResolucion,IdDireccion
-- FROM RDSAWSSQL.CATALOGO.dbo.SIGMA_CATALOGO_PEDIDOS_CABECERA AS cb WITH (NOLOCK) WHERE cb.ts > @FDESDE
-------
--CREATE TABLE #TEMPORAL_PEDIDO_HISTORICO (IdHistorial bigint,IdPedido bigint,IdEstado int,IdUsuario int,Ts datetime)
--INSERT INTO #TEMPORAL_PEDIDO_HISTORICO
--SELECT IdHistorial,IdPedido,IdEstado,IdUsuario,Ts FROM RDSAWSSQL.CATALOGO.dbo.SIGMA_CATALOGO_PEDIDOS_ESTADOS_HISTORIAL AS D WHERE D.TS > '20200801'
------
Public Class Principal
#Region "Declaraciones"
Private LABASE As String
Private SERVIDOR As String
Private mDtResultado As New DataTable
Private ConeccionExitosa As Boolean
Private ResuBoolean As Boolean = False
Private LogueoExitoso As Boolean
Private AvisarAlSalir As Boolean
Private sUsuario As String
Private FrmGestiondeDevolucion As GestiondeDevolucion
Private FrmAuditoria As AuditoriaCorreos
#End Region
#Region "Eventos"
Private Sub Principal_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try
IniciarAplicacion()
OperacionesControles()
Catch ex As Exception
GestorMensajes.MensajeDelSistema(MensajeSistema.TipoDeMensaje.Errores, "#ERROR: al intentar abrir la aplicación. " & vbCrLf & ex.Message.ToString).ShowDialog()
End Try
End Sub
#End Region
#Region "Funciones"
Private Sub OperacionesControles()
RegistroControles()
EjecutarPermisos()
End Sub
Private Sub RegistroControles()
ControlesPermisos.RegistrarControles(Me)
End Sub
Private Sub EjecutarPermisos()
ControlesPermisos.DesactivarControlesAplicacion(Me)
ControlesPermisos.ActivarControlesPorPefil(Me, My.Application.IDAPLICACION, My.Application.IDPERFIL)
ControlesPermisos.ActivarControlesPorUsuario(Me, My.Application.IDAPLICACION, My.Application.IDUSUARIO)
End Sub
Private Sub IniciarAplicacion()
InfoUsuario()
InfoBD()
ValidarVersiones(My.Application.IDAPLICACION)
If ConectarUsuarioAAplicacionSinSeguridad(My.Application.IDUSUARIO, My.Application.IDAPLICACION, My.Computer.Name.ToString, My.Application.Info.Version.ToString) = False Then
Me.Close()
Else
LogueoExitoso = True
End If
End Sub
Private Function ConectarUsuarioAAplicacionSinSeguridad(ByVal unUsuario As Integer, ByVal unaAplicacion As Integer, ByVal unaPC As String,
ByVal unaVersion As String) As Boolean
mDtResultado = New DataTable
ResuBoolean = False
mDtResultado = AccesoBase.SetSP("SP_HERRAMIENTAS_SIGMA_CONECTAR_USUARIO_A_APLICACION_SIN_BLOQUEO").SetParam(unUsuario, unaAplicacion, unaPC, unaVersion)
If mDtResultado IsNot Nothing Then
' 1 - INSERTO CORRECTAMENTE
'-1 - FALLO EL INSERT
' 2 - HIZO EL UPDATE DEL ESTADO CORRECTAMENTE
'-2 - FALLO EL UPDATE DEL ESTADO
Select Case mDtResultado.Rows(0).Item(0)
Case 1
ResuBoolean = True
Case -1
GestorMensajes.MensajeDelSistema(MensajeSistema.TipoDeMensaje.Errores, "Falló el ingreso del dato en la tabla 'HERRAMIENTAS_SIGMA_USUARIOS_CONECTADOS'").ShowDialog()
Case 2
ResuBoolean = True
Case -2
GestorMensajes.MensajeDelSistema(MensajeSistema.TipoDeMensaje.Errores, "Falló la actualización del dato en la tabla 'HERRAMIENTAS_SIGMA_USUARIOS_CONECTADOS'").ShowDialog()
End Select
Else
ResuBoolean = False
End If
Return ResuBoolean
End Function
Private Sub ValidarVersiones(ByVal unIdAplicacion As Integer)
Try
mDtResultado = New DataTable
mDtResultado = AccesoBase.SetSP("SP_MAESTRO_VERSIONES_LEER").SetParam(unIdAplicacion)
If mDtResultado IsNot Nothing Then
If mDtResultado.Rows(0).Item("VERSIONACTUAL") = My.Application.Info.Version.ToString Then
'Ok tiene la version actual
Else
If mDtResultado.Rows(0).Item("VERSIONANTERIOR") = My.Application.Info.Version.ToString Then
'Tiene la versión anterior
If mDtResultado.Rows(0).Item("URGENTE") = 0 Then
'No es urgente
Else
'La actualización debe ser inmediatamente
GestorMensajes.MensajeDelSistema(MensajeSistema.TipoDeMensaje.Adveretencia, "Su versión está desactualizada, por favor salga del Sigma y vuelva a ingresar.").ShowDialog()
Application.ExitThread()
End If
Else
'Tiene una versión no registrada - mail a sistemas
'EnviarMail("desarrollo@mimo.com.ar", "Sigma - Versión no registrada", "URGENTE. La computadora " & My.Computer.Name & " (usuario " & My.Application.IDUSUARIO & ") posee una versión no registrada de la aplicación: " & My.Application.Info.AssemblyName & " (" & VVidaplic & "). version: " & My.Application.Info.Version.ToString)
GestorMensajes.MensajeDelSistema(MensajeSistema.TipoDeMensaje.Adveretencia, "Su versión no está registrada. Envío de email automático a Sistemas.").ShowDialog()
Application.ExitThread()
End If
End If
Else
GestorMensajes.MensajeDelSistema(MensajeSistema.TipoDeMensaje.Adveretencia, "Ocurrio un error al validar la versión, se cerrará la aplicación. ").ShowDialog()
Application.ExitThread()
End If
Catch ex As Exception
GestorMensajes.MensajeDelSistema(MensajeSistema.TipoDeMensaje.Adveretencia, "Ocurrio un error al validar la versión, se cerrará la aplicación. " & vbCrLf & ex.Message.ToString).ShowDialog()
Application.ExitThread()
End Try
End Sub
Public Sub InfoBD()
If AccesoBase.ObtenerBase <> "SIGMA" Then
LABASE = " | Base: " & UCase(AccesoBase.ObtenerBase)
SERVIDOR = " | Servidor: " & IIf(UCase(AccesoBase.ObtenerServidor) = "SR01SIG01" Or UCase(AccesoBase.ObtenerServidor) = "192.168.1.20", "PRODUCCIÓN", "TESTING")
Else
LABASE = ""
'SERVIDOR = " | Servidor: " & UCase(objRemRN.ppServidor)
SERVIDOR = " | Servidor: " & IIf(UCase(AccesoBase.ObtenerServidor) = "SR01SIG01" Or UCase(AccesoBase.ObtenerServidor) = "192.168.1.20", "PRODUCCIÓN", "TESTING")
End If
Me.Text = Me.Text & SERVIDOR & LABASE & " | Versión " & My.Application.Info.Version.ToString
''Cargo la infro al supertip
'Dim sTooltip2 As SuperToolTip = New SuperToolTip
'Dim args As SuperToolTipSetupArgs = New SuperToolTipSetupArgs
'args.Title.Text = "Mensaje del sistema"
'args.Contents.Text = "Usted se encuentra en: " & vbCrLf & SERVIDOR & LABASE & vbCrLf & " | Versión " & My.Application.Info.Version.ToString
'args.Contents.Image = My.Resources.database_32x32
''args.Footer.Text = "Equipo de sistemas"
'sTooltip2.Setup(args)
'' Assign the created SuperToolTip to a BarItem.
''BarStaticItem_BASE.SuperTip = sTooltip2
End Sub
Private Sub InfoUsuario()
sUsuario = ObtenerUsuarioLogueado(My.Application.IDUSUARIO)
End Sub
Private Function ObtenerUsuarioLogueado(ByVal idUsuario As Integer) As String
mDtResultado = New DataTable
mDtResultado = AccesoBase.SetSP("SP_ECOMMERCE_DEVOLUCION_OBTENER_USUARIO_LOGUEADO").SetParam(idUsuario)
If mDtResultado IsNot Nothing Then
Return mDtResultado.Rows(0).Item(0)
Else
Return Nothing
End If
End Function
Private Sub BBI_Devoluciones_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BBI_Devoluciones.ItemClick
Try
FrmGestiondeDevolucion = New GestiondeDevolucion
FrmGestiondeDevolucion.Show()
Catch ex As Exception
GestorMensajes.MensajeDelSistema(MensajeSistema.TipoDeMensaje.Errores, "#ERROR: al intentar abrir 'Gestión de Devolucion'." & vbCrLf & ex.Message.ToString).ShowDialog()
End Try
End Sub
Private Sub BBI_AuditoriaCorreo_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BBI_AuditoriaCorreo.ItemClick
Try
FrmAuditoria = New AuditoriaCorreos
FrmAuditoria.Show()
Catch ex As Exception
GestorMensajes.MensajeDelSistema(MensajeSistema.TipoDeMensaje.Errores, "#ERROR: al intentar abrir 'Gestión Auditoria de Correos'." & vbCrLf & ex.Message.ToString).ShowDialog()
End Try
End Sub
#End Region
End Class
cuando en el asunto poseen un caracter especial por ejemplo @#$ los correos no salen y no te muestra ningun correo de rebote, especialmente...