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

📄 default.aspx.cs

📁 asp.net 的某物流管理系统 MIS 系统
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
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.OleDb;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            
            DataSet ds = new DataSet();
            ds = Getfromxml();
            this.Title = ds.Tables[0].Rows[0][0].ToString();

            OleDbDataReader dr = Getgsinfo();
            if (dr.Read())
            {
                string mystr = dr["Gsjj"].ToString();
                if (mystr.Length > 400)
                {
                    mystr = mystr.Substring(0, 400) + "...";
                }
                lblIntroduction.Text = mystr;
                lblroadline.Text = dr["Ysxl"].ToString();
                lblzizhi.Text = dr["Gszz"].ToString();
            }
        }
    }
    public OleDbDataReader Getgsinfo()
    {
        string myConnectionString = ConfigurationManager.ConnectionStrings["OLEDBCONNECTIONSTRING1"].ConnectionString + Server.MapPath("~") + ConfigurationManager.ConnectionStrings["OLEDBCONNECTIONSTRING2"].ConnectionString;
        OleDbConnection myConnection = new OleDbConnection(myConnectionString);
        string cmdText = "SELECT TOP 1 * FROM Gsinfo";
        OleDbCommand myCommand = new OleDbCommand(cmdText, myConnection);
        OleDbDataReader dr = null;
        try
        {
            myConnection.Open();
            dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
        }
        catch (OleDbException ex)
        {
            throw new Exception(ex.Message, ex);
        }
        return dr;
    }
    //读取xml
    public DataSet Getfromxml()
    {
        DataSet ds = new DataSet();
        try
        {
            ds.ReadXml(MapPath("~/info.xml"));
        }
        catch
        {
            Response.Write("<Script>alert('信息文件丢失!')</Script>");
        }
        return ds;
    }
}

⌨️ 快捷键说明

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