kk1657a 2021-11-05 16:56 采纳率: 25%
浏览 44
已结题

这种报错怎么处理呢?

以下为源代码,和报错图片

img

img

public partial class Default1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Box_Click(object sender, EventArgs e)
{

}
protected void btn_Click(object sender, EventArgs e)
{
  
    String connection="Data Source=.;Initial Catalog=no1;Integrated Security=SSPI";

SqlConnection con=new SqlConnection(connection);
con.Open();
string ConnectionString=ConfigurationManager.ConnectionStrings["othername"].ToString();
String sql2 ="insert into num(Table)(username,password)values('"+name+"','"+password+"')";
SqlCommand cmd=new SqlCommand(sql2,con);

cmd.ExecuteNonQuery();

con.Close();
Response.Write("HelloWorld!你的手机号是" + telephone.Text);
Response.Write("HelloWorld!你的密码是"+password.Text );
Response.Write("你的用户名是" + name.Text);
Response.Write("你再次输入的密码是" + password1.Text);

}
protected void btn1_Click(object sender, EventArgs e)
{
 
    String connection = "Data Source=.;Initial Catalog=no1;Integrated Security=SSPI";
    SqlConnection con = new SqlConnection(connection);
    con.Open();
    string ConnectionString = ConfigurationManager.ConnectionStrings["othername"].ToString();
    String sql1 = "select*from <Table> where id = 1";
    SqlCommand cmd = new SqlCommand(sql1, con);
    SqlDataReader read=cmd.ExecuteReader();
    if(read.Read())
    { 
    Response.Write(read["username"]+";"+read["password"]);
    }
    else{
        Response.Write("查不到");
    }
    con.Close();
    Response.Write("<script>alert('登录成功');</script>");

}

}

img

img

  • 写回答

2条回答 默认 最新

  • zxpei 2021-11-05 17:08
    关注
    SQL语句中的 <Table> 换成  [Table]
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 11月13日
  • 已采纳回答 11月5日
  • 创建了问题 11月5日

悬赏问题

  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来