sábado, 30 de noviembre de 2019

sql fecha

SELECT CONVERT(char(10), GetDate(),126)
select CONVERT(VARCHAR(10), GETDATE(),120)

jueves, 28 de noviembre de 2019

miércoles, 27 de noviembre de 2019

arrastrar y abrir archivos

Public Class drag_files

    Private Sub drag_files_DragEnter(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles MyBase.DragEnter
        If e.Data.GetDataPresent(DataFormats.FileDrop, False) = True Then
            e.Effect = DragDropEffects.All
        End If
    End Sub

    Private Sub drag_files_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles MyBase.DragDrop
        Dim drop_files() As String = e.Data.GetData(DataFormats.FileDrop)
        If drop_files.Length > 0 Then
            For Each elem In drop_files
                MessageBox.Show(elem)
            Next
        End If
    End Sub
End Class

' Propiedades AllowDrop = True
' https://www.youtube.com/watch?v=OyKv1Xcod6c

lunes, 25 de noviembre de 2019

cerrar aplicación


Private Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
        Application.Exit()
        'Environment.Exit(1)
    End Sub


fuente

aplicación ya está en ejecución

Public Function get_aplicacion_existe() As Boolean
Dim appName As String = Process.GetCurrentProcess.ProcessName
        Dim sameProcessTotal As Integer = Process.GetProcessesByName(appName).Length
        MessageBox.Show(sameProcessTotal)
        If sameProcessTotal > 1 Then
            Return 1
        Else
            Return 0
        End If
End Function

miércoles, 20 de noviembre de 2019

comuna ñuñoa


ñuñoa = NUNOA

MessageBox consulta

 Dim result As DialogResult = MessageBox.Show("¿Crear nueva cadena de conexión?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
        If result = DialogResult.Yes Then
            MessageBox.Show("si")
        ElseIf result = DialogResult.No Then
            MessageBox.Show("no")
        End If


fuente

viernes, 15 de noviembre de 2019

conex string


Data Source=1.1.1.1;Database=base;User ID=123;Password=123;

jueves, 14 de noviembre de 2019

version programa

Dim nombre_programa As String = "wsconfig"
        Dim version As String = "versión 0.63"
        Dim anio As String = ""

        Dim anio_creacion As Integer = 2019
        If anio_creacion = Now.Year Then
            anio = anio_creacion
        Else
            anio = anio_creacion & "-" & Now.Year
        End If

        ' Fecha de compilación


        Dim filepath As String = Assembly.GetExecutingAssembly().Location
        Dim dt As DateTime = New FileInfo(filepath).LastWriteTime
        'MessageBox.Show(dt.ToString("dddd", New CultureInfo("es-ES")) & " " & dt.ToString("dd-MM-yyyy HH:mm:ss"))
        ' https://docs.microsoft.com/en-us/dotnet/standard/base-types/how-to-extract-the-day-of-the-week-from-a-specific-date

        My.MySettings.Default.timesrun = My.MySettings.Default.timesrun + 1
        My.MySettings.Default.Save()


        'My.Settings.nexe = 5
        'My.Settings.Save()

        MessageBox.Show(My.Settings.timesrun)


        MessageBox.Show(nombre_programa & Environment.NewLine &
                        version & " (" & dt.ToString("dddd", New CultureInfo("es-ES")) & " " & dt.ToString("dd-MM-yyyy HH:mm:ss") & ")" & Environment.NewLine &
                        anio, "", MessageBoxButtons.OK, MessageBoxIcon.None)

miércoles, 13 de noviembre de 2019

martes, 12 de noviembre de 2019

string reverse

Dim reverse As String = StrReverse("1234567")

popup firefox

popup firefox

app.update.silent = True
app.update.url = yyyhttp://

app.update.doorhanger = False


click en el botón actualizar página, para guardar cambios


fuente

fuente2

fuente3

última modificación

Dim filepath As String = Assembly.GetExecutingAssembly().Location
        Dim dt As DateTime = New FileInfo(filepath).LastWriteTime
        MessageBox.Show(dt.ToString("HH:mm:ss dd-MM-yyyy"))


fuente

lunes, 11 de noviembre de 2019

no mostrar icono windows form


Propiedades
ShowIcon = False


fuente

comparar fecha y hora sql

if CAST('2019-11-11' as DATE) > '2019-11-10'
begin
print 'si'
end
else
begin
print 'no'
end 
     
     
if CAST('05:59:00' as TIME) > '06:00:00'
begin
print 'si'
end
else
begin
print 'no'
end

SELECT CONVERT(CHAR(10),DATEADD(DAY,1,campo_tabla),121) FROM tabla WHERE id=5510
select dateadd(DAY,1,CAST(GETDATE() AS DATE))

SELECT * FROM hist_DTE
WHERE fecha_emision >='2019-11-10' AND estado_SII='Pendiente' AND --id_DTE=5510 AND
--CONVERT(CHAR(10),GETDATE(),121)>= fecha_creacion_registro AND
CONVERT(CHAR(8),GETDATE(),108)>=CONVERT(CHAR(8),DATEADD(HOUR,11,hora_creacion_registro),108)

select CAST(CONVERT(CHAR(8),DATEADD(HOUR,11,'01:21:00'),108) AS TIME)
select CAST(CONVERT(CHAR(8),GETDATE(),108) as TIME)

fuente1

fuente2


viernes, 8 de noviembre de 2019

split salto de línea

 Dim campos() As String = Nothing
 Dim arg() As String = {vbCrLf, vbLf}
 Dim extras As String = xml.GetElementsByTagName("Extras")(0).OuterXml
campos = extras.Split(arg, StringSplitOptions.None)


fuente

miércoles, 6 de noviembre de 2019

martes, 5 de noviembre de 2019

fila existe sql


SELECT 1
FROM table_name
WHERE unique_key = value;

fuente

insertar y obtener el id

INSERT INTO buzon_out(cuenta_destino)
SELECT cuenta_destino FROM buzon_out_tmp
WHERE tipo='PDF' AND id='5504';SELECT SCOPE_IDENTITY();

fuente