Mysql 用字符串显示窗体

Mysql 用字符串显示窗体,mysql,sql,vb.net,forms,boolean,Mysql,Sql,Vb.net,Forms,Boolean,如何在显示表单之前获取所有消息,并逐个显示此表单 首先,我有一个程序,如果客户已经签出,或者客户的预订已经过期,那么它会获取一个条目。使用此方法,我将在表单中获取他们的交易编号和客户编号,并将其信息放入表单中并显示出来。请注意,对于过期预订和退房,我有一个不同的表单 有人能检查一下我的程序吗?这是我的代码,用于在客户的签入已过期时获取客户 Public Sub computeRemainingDaysForCheckedIns() Dim computedDays As Integer

如何在显示表单之前获取所有消息,并逐个显示此表单

首先,我有一个程序,如果客户已经签出,或者客户的预订已经过期,那么它会获取一个条目。使用此方法,我将在表单中获取他们的交易编号和客户编号,并将其信息放入表单中并显示出来。请注意,对于过期预订和退房,我有一个不同的表单

有人能检查一下我的程序吗?这是我的代码,用于在客户的签入已过期时获取客户

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

也许这不是最好的方法。为每一个过期的预订打开一个新的表单/弹出窗口/任何东西都可能占用您所有的资源

我建议您显示GridView、DataGrid、ListView或类似的版本,我们还在VS2008中凿出石板,所以我不确定在更新的版本中有哪些极端的技术!。可以编写隐藏的代码,以不同的颜色突出显示问题记录,使其更加明显


为此,您只需在表单上创建一个包含相关查询的数据源,然后将结果显示在适当的启用数据的网格中。

请在问题中发布代码,而不是链接到图像。我为代码创建了链接。否-在此网站上发布代码;如果PasteBin删除了你的代码,那么将来怎么会有人引用它呢?@paul我已经发布了我的代码。你能帮助我吗?