如何为用户记录登录时间 [英] How To Record Login Time For Users

查看:174
本文介绍了如何为用户记录登录时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已成为用户登录控件,但我需要记录用户登录时的时间并将时间登录保存在表中

我只需要执行此操作的过程吗?

I was make a Control For User Login but I need TO record the time when the User logs in and save the time login in the table

Just I need procedure to do this ?

推荐答案

由于您将问题标记为VB.Net,因此我了解您不需要T-SQL查询来回答您的问题.

我不知道您在哪一点上遇到困难;
您的步骤如下;

如果需要,请使用,ID,UserID,UserName,LoginTime字段创建一个表,可以将此表与Users表链接,并使用UseriD作为外键.

在您的登录页面.连接到您的数据库,然后对指定的表进行插入查询.像

Since you tagged your question as VB.Net, I understand that you dont need a T-SQL query to answer your question.

I dont know in which point you had difficulty though;
Your steps as follows;

Create a table with the fields of , ID, UserID, UserName, LoginTime if you need you can link this table with your Users table and use UseriD as a foreign key.

In your login page. Connect to your DB, and make a insert query to the specified table. Something like

Try
        Mycn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=[your db].mdb;")
        Mycn.Open()
        SQLstr = "INSERT INTO Table1 (field1, field2,field3) VALUES(''" & TextBox1.Text & "'',''" & TextBox2.Text & "'',''" & TextBox3.Text & "'')"
        Command = New OleDbCommand(SQLstr, Mycn)
        icount = Command.ExecuteNonQuery
        MessageBox.Show(icount)
    Catch ex As Exception
        MsgBox(ex)
        Mycn.Close()
    End Try


这篇关于如何为用户记录登录时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆