【发布时间】:2014-11-30 17:54:27
【问题描述】:
如何在显示表单之前获取所有消息,并将此表单一一显示?
首先,如果“客户”已经签出或者客户的预订已经过期,我有一个程序会获取一个条目。使用这种方法,我将获取他们的交易编号和客户编号,并将他们的信息放在一个表格中并显示出来。请注意,我有一个不同的 EXPIRED RESERVATION 和 CHECK OUT 表格
有人可以检查我的程序吗?如果客户的签到已过期,这是我获取客户的代码。
Public Sub computeRemainingDaysForCheckedIns()
Dim computedDays As Integer
Dim dateNow As Date = Date.Now.ToString("yyyy-MM-dd")
Try
mysqlconn = New MySqlConnection(con)
mysqlconn.Open()
query = "select TransactionNumber, ClientNumber, DATEDIFF(dateout,curdate()) as 'ComputedDays' from dbo_transactions where ClientStatus = 'Checked In'"
cmd = New MySqlCommand(query, mysqlconn)
rd = cmd.ExecuteReader
If rd.HasRows Then
'hasRows ibig sabhin mayLAMAN ung table
While rd.Read
computedDays = rd.GetString("ComputedDays")
'Console.WriteLine(computedDays)
If computedDays > 0 Then
getTransactionNumber = ""
getClientNumber = ""
ElseIf computedDays < 0 Then
getTransactionNumber = rd.GetString("TransactionNumber")
getClientNumber = rd.GetString("ClientNumber")
iTitle = "CHECK OUT CLIENT."
iMessage.AppendLine("* Client: " & getClientNumber & ", Transaction: " & getTransactionNumber & " *")
isCNotifShowed = True
End If
End While
'notificationFormC.Show()
Else
'no data
End If
mysqlconn.Close()
Catch ex As Exception
isCNotifShowed = False
MsgBox("Something Went Wrong!" & vbNewLine &
ex.Message, MsgBoxStyle.Exclamation)
Finally
mysqlconn.Dispose()
End Try
End Sub
Public Sub computeRemainingDaysForReservations()
Dim computedDays As Integer
Try
mysqlconn = New MySqlConnection(con)
mysqlconn.Open()
query = "Select TransactionNumber, ClientNumber, DATEDIFF(DateIn, CURDATE()) as 'ComputedDays' from dbo_transactions where ClientStatus = 'Reserved'"
cmd = New MySqlCommand(query, mysqlconn)
rd = cmd.ExecuteReader
If rd.HasRows Then
'hasRows ibig sabhin mayLAMAN ung table
While rd.Read
computedDays = rd.GetString("ComputedDays")
'Console.WriteLine(computedDays)
If computedDays > 0 Then
getTransactionNumber = ""
getClientNumber = ""
ElseIf computedDays <= 0 Then
getTransactionNumber = rd.GetString("TransactionNumber")
getClientNumber = rd.GetString("ClientNumber")
iiTitle = "RESERVATION IS ALREADY EXPIRED."
iiMessage.AppendLine("* " & getClientNumber & ", Transaction: " & getTransactionNumber & " *")
isRNotifShowed = True
End If
End While
Else
'no data
End If
rd.Close()
mysqlconn.Close()
Catch ex As Exception
isRNotifShowed = False
MsgBox("Something Went Wrong!" & vbNewLine &
ex.Message, MsgBoxStyle.Exclamation)
Finally
mysqlconn.Dispose()
End Try
End Sub
然后用于使用表单显示客户端
Private Sub RepeatProcess()
computeRemainingDaysForReservations()
computeRemainingDaysForCheckedIns()
If iMessage.Length <> 0 Then
ElseIf iiMessage.Length <> 0 Then
End If
'If isCNotifShowed = True Then
'notificationFormC.Show()
'ElseIf isRNotifShowed = True Then
' notificationFormR.Show()
'Else
'End If
End Sub
Private Sub timerTask_Tick_1(sender As Object, e As EventArgs) Handles timerTask.Tick
tCount += 1
If tCount = tSecs Then
Call RepeatProcess()
tCount = 0 'reset
End If
End Sub
【问题讨论】:
-
请在您的问题中发布代码,而不是链接到图片
-
我为我的代码创建了一个链接。
-
否 - 在此站点上发布您的代码;如果 PasteBin 删除了你的代码,那么以后怎么会有人引用它?
-
@paul 我已经发布了我的代码。你能帮帮我吗?
标签: mysql sql vb.net forms boolean