删除会话查询 [英] delete query with session

查看:73
本文介绍了删除会话查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 -



我想写一个代码,用户可以通过该代码在登录后停用他的帐户。

在登录页面我有创建了一个会话,并在页面加载方法中取消激活帐户页面。

这是我的删除查询但是没有使用会话值。





String SQLQuery =DELETE FROM SignUp Where Password = \'+ txtPassword.Text +\'AND EmailAddress = \'+ Session [email] + \';

Hi-

I want to write a code through which user can deactivate his account after login.
In Login page i have created a session and get it in page load method of deactivate account page.
Here is my delete query but is is not working with session value.


String SQLQuery = "DELETE FROM SignUp Where Password=\'" + txtPassword.Text + "\' AND EmailAddress= \'" + Session["email"]+ "\'";

推荐答案

这只是一个愚蠢的where子句开头。如果多个帐户符合这些条件怎么办?



当您在登录时查看用户时,您有用户数据库ID吗?这是删除帐户时应该使用的值。
That's just a stupid where clause to begin with. What if more than one account matches those conditions??

You have the users database ID when you look the user up when they login don't you?? THAT'S the value you should be using when deleting the account.


这篇关于删除会话查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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