成员资格和 SQL 问题
我正在考虑跟踪用户按下的按钮。我打算选择 CreateUserWizard 控件来为我创建数据库。 Membership 类有一些函数来识别用户是谁..例如 GetUserNameByEmail..
我想做的是跟踪每个用户按下的内容并将其输入用于 sqlCommand。 例如,当用户按下“发布响应”按钮时,我想记录他的身份并在 sql 中使用它来插入他的消息和身份。
问题是在我创建的 Users 表中,它以 UserID 作为主值标识用户的键..并且在 CreateUserWizard 数据库或会员 cookie 中,它有自己的功能字段。
所以问题是我如何从为我创建的数据库/cookie 中选择用户身份,并将其合并到我的 sqlStatement 的 SQL 语句中。
我需要获取用户的身份并在 SQL 语句中使用它..我怎样才能做到这一点?
I am thinking of following what buttons the user has pressed. I intend to choose the CreateUserWizard control that will create a database for me. The Membership class has got a few functions to identify who the user is..e.g. GetUserNameByEmail..
What i am trying to do, is to track what each user has pressed and use his input for sqlCommand.
For example, when the user presses the "post response" button, i want to record his identity and use it in sql to insert his message and identity..
The problem is that in the Users table that i made it has UserID as a primary key that identifies the user..and in the CreateUserWizard database or Membership cookie, it has its own functions fields.
So the question is how do i SELECT the users identity from the database/cookie created to me, and incorporate it into a statement in the SQL for my sqlStatement..
I need to obtain the identity of the user and use it in an SQL statement.. How can i achieve that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以从会员提供商处获取 user_id...
例如:
它将为您提供当前用户的用户 ID - 您可以在 sql 语句中使用该值。如果您使用默认的会员资格提供商 - 该值将是唯一标识符 (Guid),因此:
You can grab the user_id from the Membership provider...
for example:
the will give you the user id of the current user - and you can use that value in your sql statement. If you're using the default Membership provider - this value will be a unique identifier (Guid) so: