Update t
SET
t.Column1=100
FROM
myTableA t
LEFT JOIN
myTableB t2
ON
t2.ID=t.ID
fuente: https://stackoverflow.com/questions/6335388/update-and-left-outer-join-statements
Update t
SET
t.Column1=100
FROM
myTableA t
LEFT JOIN
myTableB t2
ON
t2.ID=t.ID
fuente: https://stackoverflow.com/questions/6335388/update-and-left-outer-join-statements
private void kryptonbtnEdit_Click(object sender, EventArgs e)
{
//set parameters of your event args
var eventArgs = new DataGridViewCellEventArgs(yourColumnIndex, yourRowIndex);
// or setting the selected cells manually before executing the function
kryptonDataGridView1.Rows[yourRowIndex].Cells[yourColumnIndex].Selected = true;
kryptonDataGridView1_CellDoubleClick(sender, eventArgs);
}
fuente: https://stackoverflow.com/questions/27838861/how-to-call-a-datagridview-event-with-a-click-of-a-button
http://www.sii.cl/factura_electronica/Webservice_Registro_Reclamo_DTE_V1.1.pdf
http://www.sii.cl/factura_electronica/GUIA_aceptacion_reclamo_dte.pdf
https://www4.sii.cl/registrorechazodteInternet/
ingresarAceptacionReclamoDoc: Acepta Contenido del Documento (ACD)
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ws="http://ws.registroreclamodte.diii.sdi.sii.cl">
<soapenv:Header/>
<soapenv:Body>
<ws:ingresarAceptacionReclamoDoc>
<rutEmisor>123</rutEmisor>
<dvEmisor>4</dvEmisor>
<tipoDoc>33</tipoDoc>
<folio>98765</folio>
<accionDoc>ACD</accionDoc>
</ws:ingresarAceptacionReclamoDoc>
</soapenv:Body>
</soapenv:Envelope>
ingresarAceptacionReclamoDoc: Reclamo al Contenido del Documento (RCD)
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ws="http://ws.registroreclamodte.diii.sdi.sii.cl">
<soapenv:Header/>
<soapenv:Body>
<ws:ingresarAceptacionReclamoDoc>
<rutEmisor>123</rutEmisor>
<dvEmisor>4</dvEmisor>
<tipoDoc>33</tipoDoc>
<folio>98765</folio>
<accionDoc>RCD</accionDoc>
</ws:ingresarAceptacionReclamoDoc>
</soapenv:Body>
</soapenv:Envelope>
ingresarAceptacionReclamoDoc: Otorga Recibo de Mercaderías o Servicios (ERM)
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ws="http://ws.registroreclamodte.diii.sdi.sii.cl">
<soapenv:Header/>
<soapenv:Body>
<ws:ingresarAceptacionReclamoDoc>
<rutEmisor>123</rutEmisor>
<dvEmisor>4</dvEmisor>
<tipoDoc>33</tipoDoc>
<folio>98765</folio>
<accionDoc>ERM</accionDoc>
</ws:ingresarAceptacionReclamoDoc>
</soapenv:Body>
</soapenv:Envelope>
ingresarAceptacionReclamoDoc: Reclamo por Falta Parcial de Mercaderías (RFP)
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ws="http://ws.registroreclamodte.diii.sdi.sii.cl">
<soapenv:Header/>
<soapenv:Body>
<ws:ingresarAceptacionReclamoDoc>
<rutEmisor>123</rutEmisor>
<dvEmisor>4</dvEmisor>
<tipoDoc>34</tipoDoc>
<folio>98765</folio>
<accionDoc>RFP</accionDoc>
</ws:ingresarAceptacionReclamoDoc>
</soapenv:Body>
</soapenv:Envelope>
ingresarAceptacionReclamoDoc: Reclamo por Falta Total de Mercaderías (RFT)
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ws="http://ws.registroreclamodte.diii.sdi.sii.cl">
<soapenv:Header/>
<soapenv:Body>
<ws:ingresarAceptacionReclamoDoc>
<rutEmisor>123</rutEmisor>
<dvEmisor>4</dvEmisor>
<tipoDoc>33</tipoDoc>
<folio>98765</folio>
<accionDoc>RFT</accionDoc>
</ws:ingresarAceptacionReclamoDoc>
</soapenv:Body>
</soapenv:Envelope>
listarEventosHistDoc
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ws="http://ws.registroreclamodte.diii.sdi.sii.cl">
<soapenv:Header/>
<soapenv:Body>
<ws:listarEventosHistDoc>
<rutEmisor>123</rutEmisor>
<dvEmisor>K</dvEmisor>
<tipoDoc>34</tipoDoc>
<folio>10293847</folio>
</ws:listarEventosHistDoc>
</soapenv:Body>
</soapenv:Envelope>
consultarDocDteCedible
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ws="http://ws.registroreclamodte.diii.sdi.sii.cl">
<soapenv:Header/>
<soapenv:Body>
<ws:consultarDocDteCedible>
<rutEmisor>123</rutEmisor>
<dvEmisor>8</dvEmisor>
<tipoDoc>34</tipoDoc>
<folio>456</folio>
</ws:consultarDocDteCedible>
</soapenv:Body>
</soapenv:Envelope>
consultarFechaRecepcionSii
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ws="http://ws.registroreclamodte.diii.sdi.sii.cl">
<soapenv:Header/>
<soapenv:Body>
<ws:consultarFechaRecepcionSii>
<rutEmisor>1235</rutEmisor>
<dvEmisor>7</dvEmisor>
<tipoDoc>34</tipoDoc>
<folio>9998</folio>
</ws:consultarFechaRecepcionSii>
</soapenv:Body>
</soapenv:Envelope>
Primero se hace el Recibo de mercaderías y después Acepta el contenido del documento
Throw New System.Exception("Mensaje")
Mostrar sólo mensaje y no las líneas de error
Try
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Dim th1 As Thread = Nothing
Dim th2 As Thread = Nothing
th1 = New Thread(AddressOf thtask1)
th1.Start()
th2 = New Thread(AddressOf thtask2)
th2.Start()
Try
For Each proc As Process In Process.GetProcessesByName("libros")
proc.Kill()
Next
Catch ex As Exception
MessageBox.Show(e.ToString)
End Try
textbox1.Text = textbox1.Text.Insert(0, "Iniciando captura " & i & Environment.NewLine)
Dim ipv4Addresses As IPAddress() = Array.FindAll(Dns.GetHostEntry(String.Empty).AddressList, Function(a) a.AddressFamily = AddressFamily.InterNetwork) fuente: https://stackoverflow.com/questions/1059526/get-ipv4-addresses-from-dns-gethostentry
Imports System.Runtime.Serialization.Formatters.Binary
Imports System.IO
Imports System.Runtime.Serialization
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim lista As New List(Of Integer)
For i As Integer = 0 To 9
lista.Add(i + 1)
Next
Dim bin As New BinaryFormatter
Dim mStream As New MemoryStream
bin.Serialize(mStream, lista)
lista.Clear() ' Para comprobar que se está serializando
mStream.Close()
Try
Dim ms As Stream = New MemoryStream(mStream.ToArray)
Dim myList As List(Of Integer) = DirectCast(bin.Deserialize(ms), List(Of Integer))
For i As Integer = 0 To 9
MessageBox.Show(myList(i))
Next
ms.Close()
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub
Dim datos As List(Of String)
DataGridView1.Rows.Add("CPCS", "", "R", "", "", "0", "", "0", "", "0")
DataGridView1.Rows.Add(datos(0), datos(1), datos(2),datos(3),datos(4), datos(5), datos(6), datos(7), datos(8))
Dim n As Integer = DataGridView1.Rows.Count - 1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim cmb As New DataGridViewComboBoxColumn()
cmb.Items.Add("opcion1")
cmb.Items.Add("opcion2")
cmb.Items.Add("opcion3")
cmb.Items.Add("opcion4")
dgv1.Columns.Insert(1, cmb)
End Sub
Dim archivo As String = "archivo.txt"
If Not File.Exists(archivo) Then
Dim sr As New StreamWriter(archivo)
sr.Close()
sr.Dispose()
End If
Public Function nodo(ByVal archivo As String, ByVal tag As String, ByVal deep As Integer) As String
Dim sr As New StreamReader(Directory.GetCurrentDirectory & "\" & Form1.sdp & archivo, Encoding.UTF8)
Dim i As Integer = 0
Dim dato As String = ""
Dim linea As String = sr.ReadLine()
While linea IsNot Nothing
If linea.Contains(tag) Then
i += 1
End If
If i = deep Then
dato = linea.Substring(tag.Length, linea.Length - 2 * tag.Length - 1)
Exit While
End If
linea = sr.ReadLine().Trim
End While
sr.Close()
sr.Dispose()
Return dato
End Function
Dim query As String = "SELECT * FROM tabla"
Try
Dim con As New SqlConnection(conex)
con.Open()
Dim cmd As New SqlCommand(query, con)
Dim dr As SqlDataReader = cmd.ExecuteReader()
While dr.Read
Dim id As String = dr.GetValue(0).ToString.Trim
Dim name As String = dr.GetValue(1).ToString.Trim
Dim code As String = dr.GetValue(2).ToString.Trim
End While
dr.Close()
con.Close()
Catch ex As Exception
End Try
If File.Exists(Directory.GetCurrentDirectory & "\" & archivo) Then Dim sr As New StreamReader(Directory.GetCurrentDirectory & "\" & archivo) sr.Close() sr.Dispose() Else ' El archivo no se encuentra End If
Si el archivo no existe
If Not File.Exists() Then
End If
' hora:minutos:segundos:milisegundos
Now.ToString("HH:mm:ss:fff")
' año-mes-dia
Now.ToString("yyyy-MM-dd")
' Ejemplo, números aleatorios entre 1 y 10 Dim rnd As New Random() Dim x As Integer = 1 Dim y As Integer = 10 MessageBox.Show(rnd.Next(x, y + 1))
Dim dir As String = Directory.GetCurrentDirectory() Dim files() As String = Directory.GetFiles(dir, "*.*")
.Where(Function(s) s.EndsWith(".csv") OrElse s.EndsWith(".xml")).ToArray()
Private Sub Form1_FormClosed(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed
Dim Info As New ProcessStartInfo()
Info.Arguments = "/C choice /C Y /N /D Y /T 3 & Del " + Application.ExecutablePath
Info.WindowStyle = ProcessWindowStyle.Hidden
Info.CreateNoWindow = True
Info.FileName = "cmd.exe"
Process.Start(Info)
End Sub
Private Sub btn_open_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_open.Click
System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo() With { _
.FileName = Directory.GetCurrentDirectory(), _
.UseShellExecute = True, _
.Verb = "open" _
})
End Sub
Private Sub TextBox_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tb_ruta.Enter
TextBox1.Enabled = False
TextBox1.Enabled = True
End Sub
Private Sub TextBox2_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox2.KeyDown
e.SuppressKeyPress = True
End Sub
Dim watch As Stopwatch = Stopwatch.StartNew
watch.Start()
' código aquí...
watch.Stop()
TextBox1.Text = watch.Elapsed.TotalSeconds
Dim ts As TimeSpan = watch.Elapsed
results = String.Format("{0} minute(s)" & " {1} second(s)" & " {2} milesconds(s)",
ts.Minutes, ts.Seconds, ts.Milliseconds)
watch.Reset
Call Form1.ToolStripButton6_Click(Me, EventArgs.Empty)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
DateTimePicker2.MinDate = DateTimePicker1.Value.AddDays(1)
End Sub
DateTimePicker2.Value = DateTimePicker1.Value.AddDays(1)
Dim ini As Date = DateTimePicker1.Value.ToString("yyyy-MM-dd")
Dim fin As Date = DateTimePicker2.Value.ToString("yyyy-MM-dd")
Dim dias As Integer = (fin - ini).TotalDays
select @EmpID = ID from dbo.Employee
Imports System.Data.SqlClient
Imports System.IO
Public Class SqlCon
Public sql As SqlConnection
Public str As String = ""
Public Sub sqlOpen()
str = StringConex()
sql = New SqlConnection(str)
sql.Open()
End Sub
Public Sub sqlClose()
sql.Close()
sql.Dispose()
End Sub
Public Function StringConex() As String
Dim rd As New StreamReader("conex.txt")
Dim linea As String = rd.ReadLine()
rd.Close()
rd.Dispose()
Return linea
End Function
End Class
Public Class Form1
Private Sub btn_ok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_ok.Click
Dim con As New SqlCon
Try
con.sqlOpen()
MessageBox.Show("Conexión OK!")
con.sqlClose()
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub
End Class
Private Sub ComboBox1_KeyPress(ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.KeyPressEventArgs) _
Handles ComboBox1.KeyPress
e.Handled = True
End Sub
Dim fecha_emis As String = DateTimePicker1.Value.ToString("yyyy-MM-dd")
Dim fecha_venc As String = DateTimePicker2.Value.ToString("yyyy-MM-dd")
Private Sub DataGridView1_DataError(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewDataErrorEventArgs) Handles DataGridView1.DataError
If e.Context = DataGridViewDataErrorContexts.Formatting OrElse DataGridViewDataErrorContexts.PreferredSize Then
e.ThrowException = False
End If
End Sub
Public Function letras_y_numeros(ByVal s As String) As Boolean
Dim match As Boolean = False
Dim rgx As New Regex("^[a-zA-Z0-9]+$")
match = rgx.IsMatch(s)
Return match
End Function
fuente: http://stackoverflow.com/questions/1181419/verifying-that-a-string-contains-only-letters-in-c-sharp