⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 signup.aspx.cs

📁 it is designed using asp.net2005 and c#
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page
{
    SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=D:\myhotel\App_Data\myhotel.mdf;Integrated Security=True;User Instance=True");
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.IsPostBack==false)
        Button2.Enabled = false;
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        //try
        //{
            SqlCommand cmd = new SqlCommand("INSERT INTO user_info VALUES('" + TextBox1.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox9.Text + "','" + TextBox5.Text + "','" + TextBox6.Text + "','" + TextBox7.Text + "','" + TextBox8.Text + "')", con);
            con.Open();
            cmd.ExecuteNonQuery();
            con.Close();
        //}
        //catch (Exception ex)
        //{
            //Response.Write(ex.Message);
        //}
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        int flag = 0;
        SqlDataAdapter da = new SqlDataAdapter("SELECT userid FROM user_info",con);
        DataSet ds = new DataSet();
        da.Fill(ds,"user");
        for (int i = 0; i <= ds.Tables["user"].Rows.Count - 1; i++)
        {
            if (TextBox7.Text == ds.Tables["user"].Rows[i][0].ToString())
            {
                //Label1.Text = "Not available";
                flag = 1;
                break;
            }
            else
                continue;
        }
        if (flag == 1)
            Label1.Text = "not available";
        else
        {
            Label1.Text = "available";
            Button2.Enabled = true;
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -