dimanche 29 novembre 2015

Error dont know what to do. project DTR

i think somethings wrong with my codes or query, i just want to make an error messagebox if the user time in twice a day. My error is it always go to the else statement part where the user will time in even though he/she already time in, my database is now full of duplicated records . could someone help me? sorry for my bad english hope you understand.

   Public Sub isTimein_Exist()
    Try
        Dim dbConnection As New MySqlConnection(dbConstring)
        dbQuery = "Select empid, date from tbldtr where empid = '" & txtInputID.Text & "' and date = '" & Date.Today & "'"
        dbCmd = New MySqlCommand(dbQuery, dbConnection)
        dbConnection.Open()
        dbReader = dbCmd.ExecuteReader()
        If dbReader.Read = True Then

            MsgBox("You Have TIME-IN Already", MsgBoxStyle.Information, "Time-IN")
            Exit Sub
        Else
            Timein()
        End If

    Catch ex As Exception

    End Try
End Sub

Aucun commentaire:

Enregistrer un commentaire