修改密码的模块如何插入主程序?是visual studi

conn.Open(); if( txtname .Text==""||txtpassword .Text=="") MessageBox.Show ("请不要遗漏信息!"); if (rbtnmanager.Checked) { string cstr="select * from 用户登录 where 类别='管理员'and 用户名='"+txtname.Text.Trim ()+"'and 密码='"+txtpassword .Text.Trim ()+"'"; SqlCommand comm=new SqlCommand (cstr,conn ); SqlDataReader dr=comm.ExecuteReader (); if (dr.Read()) { sn = txtname.Text.Trim(); fr4.Show(); this.Visible = false; } else { MessageBox.Show("输入有误,请重新输入!"); txtname.Text = ""; txtpassword.Text = ""; } } if (rbtnteacher.Checked) { string cstr = "select * from 用户登录 where 类别='教师'and 用户名='" + txtname.Text.Trim() + "'and 密码='" + txtpassword.Text.Trim() + "'"; SqlCommand comm = new SqlCommand(cstr, conn); SqlDataReader dr = comm.ExecuteReader(); if (dr.Read()) { sn = txtname.Text.Trim(); sub = dr.GetValue(3).ToString (); fr3.Show(); this.Visible = false; } else { MessageBox.Show("输入有误,请重新输入!"); txtname.Text = ""; txtpassword.Text = ""; } } if (rbtnstudent.Checked) { string cstr = "select * from 用户登录 where 类别='学生'and 用户名='" + txtname.Text.Trim() + "'and 密码='" + txtpassword.Text.Trim() + "'"; SqlCommand comm = new SqlCommand(cstr, conn); SqlDataReader dr = comm.ExecuteReader(); if (dr.Read()) { sn = txtname.Text.Trim();fr2.Show(); this.Visible=false ; } else { MessageBox.Show("输入有误,请重新输入!"); txtname.Text = ""; txtpassword.Text = ""; } } conn.Close(); conn.Dispose(); } private void button2_Click(object sender, EventArgs e) { Application.Exit(); } private void timer1_Tick(object sender, EventArgs e) { label1.Text = "当前时间为:" +DateTime.Now .ToLongDateString() +" "+DateTime.Now.ToLongTimeString(); } } }

1个回答

你主程序中找到用户登录窗体,然后添加一个按钮,粘贴进去。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问