• 大小: 490KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-01
  • 语言: C#
  • 标签:

资源简介

简单的机票预订系统,asp.net,用c#编写。sqlserver数据库。

资源截图

代码片段和文件信息

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 administrator : System.Web.UI.Page
{
    protected void Page_Load(object sender EventArgs e)
    {
        if ((String)Session[“pwd“] != “administrator“) Response.Redirect(“login.aspx“);
    }
    protected void Button1_Click(object sender EventArgs e)
    {
        SqlConnection conn1 = new SqlConnection(@“Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\fly.mdf;Integrated Security=True;User Instance=True“);
        conn1.Open();
        String s1 = (string)TextBox1.Text s2 = (string)TextBox2.Text s3 = (string)TextBox3.Text;
        try
        {
            SqlCommand cmd1 = new SqlCommand(“insert into flyinfo(fnodesftime) values(‘“ + s1 + “‘‘“ + s2 + “‘‘“ + s3 + “‘)“);
            cmd1.Connection = conn1;
            cmd1.ExecuteNonQuery();
            Response.Write(“ript>alert(\“插入ok。\“)ript>“);
            cmd1.Dispose();
            conn1.Close();
        }
        catch (Exception g) { Response.Write(“ript>alert(\“wrong\“)ript>“); }
        DropDownList1.DataBind();
        DropDownList2.DataBind();
        DropDownList3.DataBind();
    }
  
    protected void Button2_Click(object sender EventArgs e)
    {
        SqlConnection conn2 = new SqlConnection(@“Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\fly.mdf;Integrated Security=True;User Instance=True“);
        conn2.Open();
        try
        {
            String s1 = (DropDownList1.SelectedItem).ToString(); int s2 = Convert.ToInt32(TextBox4.Text) s3 = Convert.ToInt32(TextBox8 .Text);
            SqlCommand cmd2 = new SqlCommand(“insert into seat(fnostotle) values(‘“ + s1 + “‘“+s2+“)“);
            SqlCommand cmd3 = new SqlCommand(“insert into price(fnocost) values(‘“+s1+“‘“+s3+“)“);
            cmd2.Connection = conn2;
            cmd2.ExecuteNonQuery();
            cmd2.Dispose();         
            cmd3.Connection = conn2;
            cmd3.ExecuteNonQuery();
            cmd3.Dispose();
            conn2.Close();
            Response.Write(“ript>alert(\“插入ok。\“)ript>“);
        }
        catch (Exception g) { Response.Write(“ript>alert(\“wrong\“)ript>“); }  
    }
    protected void Button3_Click(object sender EventArgs e)
    {
        SqlConnection conn3 = new SqlConnection(@“Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\fly.mdf;Integrated Security=True;User Instance=True“);
        conn3.Open();
        double i j k;
        String s4 = (DropDownList2.SelectedItem).ToString();
        String sql = “select *from seat where fno=‘“+s4+“‘“;
        SqlCommand cmd3 = new SqlCommand(sql);
        cmd3.Connection = conn3;
        SqlDat

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       9952  2008-07-06 09:37  website\administrator.aspx

     文件       4587  2008-07-06 10:58  website\administrator.aspx.cs

     文件        445  2005-11-12 04:28  website\Default.aspx

     文件        383  2005-09-07 09:40  website\Default.aspx.cs

     文件     917504  2008-07-06 11:03  website\fly.mdf

     文件     516096  2008-07-06 11:03  website\fly_log.LDF

     文件       1035  2008-07-01 19:09  website\login.aspx

     文件        855  2008-07-05 21:00  website\login.aspx.cs

     文件       2274  2008-07-03 08:50  website\Web.Config

    ..A..H.      8704  2008-08-27 09:27  website\website.suo

     文件    1835008  2008-09-04 12:59  website\App_Data\fly.mdf

     文件    3932160  2008-09-04 12:59  website\App_Data\fly_log.LDF

     目录          0  2008-07-06 20:40  website\App_Data

     文件       4668  2008-09-04 12:52  website\client.aspx

     文件       6286  2008-09-04 12:55  website\client.aspx.cs

     文件       1454  2008-09-04 12:59  website\website (2).sln

    ..A..H.     10240  2008-09-04 12:59  website\website (2).suo

     目录          0  2008-07-06 20:40  website

----------- ---------  ---------- -----  ----

              7251651                    18


评论

共有 条评论