web/WebUserControl8.ascx.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

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;
using System.Data;

public partial class web_WebUserControl8 : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
    //    //TextBox1.Text = Request.QueryString["Name"];
    //    string ConnStr1 = System.Configuration.ConfigurationManager.ConnectionStrings["ConnStr"].ToString();
    //    SqlConnection cn = new SqlConnection(ConnStr1);
    //    cn.ConnectionString = ConnStr1;
    //    String sql1 = "select RoomId,RcategoryId,Rposition,Description from RoomsInfo where Roomid='" + TextBox1.Text.Trim() + "'";
    //    cn.Open();
    //    SqlCommand cmd = new SqlCommand(sql1, cn);
    //    SqlDataAdapter da = new SqlDataAdapter();
    //    DataSet ds = new DataSet();
    //    da.SelectCommand = cmd;
    //    da.Fill(ds);
    //    DataRow dr = ds.Tables[0].Rows[0];
    //    cn.Close();
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
       // int s2 = int.Parse(DropDownList1.SelectedItem);
       // string s3 = TextBox3.Text.Trim();
        //string s4 = TextBox4.Text.Trim();
        string ConnStr1 = System.Configuration.ConfigurationManager.ConnectionStrings["ConnStr"].ToString();
        SqlConnection cn = new SqlConnection(ConnStr1);
        cn.ConnectionString = ConnStr1;
        string sql = "select count(*) from RoomsInfo where RoomId='"+TextBox1.Text.Trim()+"'";
        String sql1 = "insert into RoomsInfo values('" + TextBox1.Text.Trim() + "','" + DropDownList1.SelectedItem + "','" + TextBox3.Text.Trim() + "','" + TextBox4.Text.Trim() + "')";
        cn.Open();
        SqlCommand cmd = new SqlCommand(sql,cn);
        SqlCommand cmd1 = new SqlCommand(sql1, cn);
        int count = (int)cmd.ExecuteScalar();
        if (DropDownList1.SelectedItem.ToString() != "" && count == 0)
        {
            cmd1.ExecuteNonQuery();
            cn.Close();
            Response.Write("<script language=javascript>alert('添加成功!!');</script>");
        }
        else if (count >= 1)
        {
            Response.Write("<script language=javascript>alert('房间号已经存在!!');</script>");
        }
        else
        {
            Response.Write("<script language=javascript>alert('房间类型不能为空,只能取整(1,2,3..)!!');</script>");
        }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        Response.Redirect("RoomsMan.aspx");
后面还有 2 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。