请问用C#链接mysql数据库密码找回找回密码怎么实现 我是新手情大神写详细一点,

各位高手帮个忙,我是新手,想用C#.NET实现个找回密码的功能,就是根据帐号,密保问题和答案找回密码。_百度知道
各位高手帮个忙,我是新手,想用C#.NET实现个找回密码的功能,就是根据帐号,密保问题和答案找回密码。
表名比getpassword,表Userid(帐号),Userpassword(密码),Userquestion(保护问题),Useranswer(问题答案)帐号.保护问题.问题答案都数据库致用textbox输密码各位哥帮忙谢谢~
提问者采纳
//帮编完整简单易懂代码://数据库跟我用Access数据库//前台代码//=============================&%@ Page Language=&C#& AutoEventWireup=&true& CodeFile=&getPwd.aspx.cs& Inherits=&getPwd& %&&!DOCTYPE html PUBLIC &-//W3C//DTD XHTML 1.0 Transitional//EN& &&&&html xmlns=&& &&head runat=&server&&
&title&标题页&/title&&/head&&body&
&form id=&form1& runat=&server&&
&div runat=&server& id=&u2&&
账号:&asp:TextBox ID=&TextBox1& runat=&server&&&/asp:TextBox&&&asp:Button ID=&Button1& runat=&server& Text=&提交& OnClick=&Button1_Click& /&&br /&
&asp:Label ID=&Label1& runat=&server&&&/asp:Label&&br /&
&div runat=&server& id=&u1&&
账号:&asp:Label ID=&Label2& runat=&server& Text=&Label&&&/asp:Label&&br /&
问题:&asp:Label ID=&Label3& runat=&server& Text=&Label&&&/asp:Label&&br /&
您答:&asp:TextBox ID=&TextBox2& runat=&server&&&/asp:TextBox&&br /&
&asp:Button ID=&Button2& runat=&server& Text=&提交& OnClick=&Button2_Click& /&&br /&
&asp:Label ID=&Label4& runat=&server&&&/asp:Label&&br /&
&div id=&u3& runat=&server&&
您密码:&asp:Label ID=&Label5& runat=&server& ForeColor=&Red&&&/asp:Label&
&/form&&/body&&/html&//==============================//台代码//==============================using Susing System.Dusing System.Cusing System.Cusing System.Wusing System.Web.Susing System.Web.UI;using System.Web.UI.WebCusing System.Web.UI.WebControls.WebPusing System.Web.UI.HtmlCusing System.Data.OleDb;public partial class getPwd : System.Web.UI.Page{
protected void Page_Load(object sender, EventArgs e)
if (!Page.IsPostBack)
u1.Visible =
u2.Visible =
u3.Visible =
protected void Button1_Click(object sender, EventArgs e)
string id = TextBox1.Text.Trim();
string sql = &select * from getpassword where UserId='& + id + &'&;
OleDbConnection conn = new OleDbConnection(&Provider=Microsoft.Jet.OLEDB.4.0;Data Source=& + Server.MapPath(&user.mdb&));
OleDbCommand cmd = new OleDbCommand(sql, conn);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, &info&);
if (ds.Tables[&info&].Rows.Count != 0)
u1.Visible =
u2.Visible =
Label2.Text =
Label3.Text = ds.Tables[&info&].Rows[0][&Userquestion&].ToString();
Label1.Text = &账号存&;
protected void Button2_Click(object sender, EventArgs e)
string answer = TextBox2.Text.Trim();
string sql = &select * from getpassword where UserId='& + Label2.Text + &' and Useranswer='& + answer + &'&;
OleDbConnection conn = new OleDbConnection(&Provider=Microsoft.Jet.OLEDB.4.0;Data Source=& + Server.MapPath(&user.mdb&));
OleDbCommand cmd = new OleDbCommand(sql, conn);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, &getPwd&);
if (ds.Tables[&getPwd&].Rows.Count != 0)
u1.Visible =
u2.Visible =
u3.Visible =
Label5.Text = ds.Tables[&getPwd&].Rows[0][&UserPwd&].ToString();
Label4.Text = &您答确&;
提问者评价
已经解决啦,还是谢谢你们
其他类似问题
为您推荐:
密保问题的相关知识
其他3条回答
string userid=&Select Useranswer from getpassword where Userid = '& +Textbox1.Text.Tostring()+&'&
DataSet ds = new DataSet(userid);
SqlDataAdapter adapter = new SqlDataAdapter(sql, connection);
adapter.Fill(ds);
string userid=&Select Useranswer from getpassword where Userid = '& +Textbox1.Text.Tostring()+&'& DataSet ds = new DataSet(userid); SqlDataAdapter adapter = new SqlDataAdapter(sql, connection); adapter.Fill(ds); 这样就OK了
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁C#链接SqlServer2008基础_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
C#链接SqlServer2008基础
上传于||文档简介
&&刚​写​了​书​,​做​了​个​基​础​信​息​管​理​,​给​那​些​刚​接​触​C​#​要​链​接​S​Q​L​s​e​r​v​e​r​的​朋​友​一​点​提​示​吧​!​免​费​的​,​很​简​单​,​赚​人​气​!
阅读已结束,如果下载本文需要使用0下载券
想免费下载更多文档?
下载文档到电脑,查找使用更方便
还剩1页未读,继续阅读
你可能喜欢关于VS2010用C#链接SQL2008数据库的问题,大神帮帮小弟。_百度知道
关于VS2010用C#链接SQL2008数据库的问题,大神帮帮小弟。
我贴代码先我I估计代码没错程序思想通链接数据库查询表信息放Datagridview控件using Susing System.Collections.GponentMusing System.Dusing System.Dusing System.Lusing System.Tusing System.Windows.Fusing System.Data.OleDb;namespace 公告栏{& & public partial class Form1 : Form& & {& & & & public Form1()& & & & {& & & & & & InitializeComponent();& & & & }& & & & OleDbConnection con = new OleDbConnection(&Provider=SQLOLEDB;Data Source=6OX.;User Id=password=7792285;database=student&);& & & & private void Form1_Load(object sender, EventArgs e)& & & & {& & & & & & this.CenterToScreen();& & & & & & con.Open();& & & & & & OleDbDataAdapter xs=new OleDbDataAdapter(&select Sno 号,Sname 姓名,Sex 性别,Sdept 系名称, Stel 手机或电,Sbirth 期 from student&,con);& & & & & & DataSet fc=new DataSet();& & & & & & xs.Fill(fc);& & & & & & dataGridView1.DataSource=fc.Tables[0];& & & & }& & & & private void button1_Click(object sender, EventArgs e)& & & & {& & & & & & DataSet fc=new DataSet();& & & & & & OleDbDataAdapter xs = new OleDbDataAdapter(&select Sno 号,Sname 姓名,Sex 性别,Sdept 系名称, Stel 手机或电,Sbirth 期 from student&, con);& & & & & & xs.Fill(fc);& & & & & & dataGridView1.DataSource = fc.Tables[0];& & & & }& & }}PS:运行行错误我贴图清楚哪错我发现我VSSQL同打候VS发错误要关闭掉清楚没影响提示内存类解决才能使程序确
提问者采纳
dataGridView1.DataSource = fc.Tables[0]; 数据源改
试试 查询数据库access SqlServer 自看看吧
问题追问 求积啊
一样不行恩。。
提问者评价
其他类似问题
为您推荐:
vs2010的相关知识
其他2条回答
要连接数据库标题写要连sql 代码连确实access
我想链接的是本机上的SQL数据库。我的代码写的是链接access??
嗯,解决了吗?
留联系看。
帮帮小弟呀。
留联系看。
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁}

我要回帖

更多关于 数据库详细设计文档 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信