m0_71452959 2023-03-24 21:53 采纳率: 16.7%
浏览 25

asp.net注册页面输入用户名和密码,没有弹出错误或者成功的提示框,为什么?

using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Data.SqlClient;using System.Configuration;namespace Eshop{ public partial class login : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { } protected void TextBox3_TextChanged(object sender, EventArgs e) { } protected void TextBox1_TextChanged(object sender, EventArgs e) { } protected void btnLogin_Click(object sender, EventArgs e) { //1.创建连接对象 SqlConnection cn = new SqlConnection(); cn.ConnectionString =ConfigurationManager . ConnectionStrings["eshopConnectionString"].ConnectionString; cn.Open(); //2.创建命令对象 SqlCommand cm = new SqlCommand(); cm.Connection = cn; cm.CommandText = string.Format("select * from member where LoginName='{0}'and LoginPwd='{1}'", txtAccount.Text,txtPassword.Text); //3.执行命令对象,返回数据阅读器 SqlDataReader dr = cm.ExecuteReader(); if (dr.Read()) { String username = dr["LoginName"].ToString(); Response.Write(""); //4.返回结果 } else { Response.Write(""); } dr.Close(); cn.Close(); } protected void txtPassword_TextChanged(object sender, EventArgs e) { } protected void btnReg_Click(object sender, EventArgs e) { if(txtAccount.Text == "123" && txtPassword.Text == "123456") Response.Write(""); } }}

img

  • 写回答

2条回答 默认 最新

  • threenewbee 2023-03-24 21:57
    关注

    代码全部黏在一起了,换行都没有的,你重新写下

    评论

报告相同问题?

问题事件

  • 创建了问题 3月24日

悬赏问题

  • ¥15 结构功能耦合指标计算
  • ¥20 visual studio中c语言用ODBC链接SQL SERVER
  • ¥50 AI大模型精调(百度千帆、飞浆)
  • ¥15 非科班怎么跑代码?如何导数据和调参
  • ¥15 福州市的全人群死因监测点死亡原因报表
  • ¥15 Altair EDEM中生成一个颗粒,并且各个方向没有初始速度
  • ¥15 系统2008r2 装机配置推荐一下
  • ¥15 悬赏Python-playwright部署在centos7上
  • ¥15 psoc creator软件有没有人能远程安装啊
  • ¥15 快速扫描算法求解Eikonal方程咨询