Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        DataSet ds;
        if (Request.QueryString.ToString() != "")
        {
            ds = DB.GetContentByID(Request.QueryString["type"], Request.QueryString["id"]);

            int ipsrcnum = ds.Tables[0].Rows[0]["vSrcAddr"] == DBNull.Value ? 0 : Convert.ToInt32(ds.Tables[0].Rows[0]["vSrcAddr"]);
            int ipdstnum = ds.Tables[0].Rows[0]["vDstAddr"] == DBNull.Value ? 0 : Convert.ToInt32(ds.Tables[0].Rows[0]["vDstAddr"]);

            txtSrcMac.Text = ds.Tables[0].Rows[0]["vSrcMac"].ToString();
            txtSrcAddr.Text = common.NumberToIP(ipsrcnum);
            txtDstMac.Text = ds.Tables[0].Rows[0]["vDstMac"].ToString();
            txtDstAddr.Text = common.NumberToIP(ipdstnum);
            txtLogin.Text = ds.Tables[0].Rows[0]["vLogin"].ToString();
            txtPwd.Text = ds.Tables[0].Rows[0]["vPwd"].ToString();

            dbConfig df = new dbConfig();

            ltArea.Text = df.GetIpArea(ipdstnum);

            //DB.SetReaded(Request.QueryString["type"], Request.QueryString["id"]);
        }
    }
Пример #2
0
    /// <summary>
    /// 获取IP的具体地址信息
    /// </summary>
    /// <param name="ipnum">大地址</param>
    /// <param name="ip">IP值</param>
    /// <returns>IP的具体地址信息</returns>
    public static string GetIpAreaInfo(string ipnum, string ip)
    {
        if (string.IsNullOrEmpty(ip))
        {
            return string.Empty;
        }

        dbConfig db2 = new dbConfig();

        if (string.IsNullOrEmpty(ipnum))
        {
            return db2.GetIpArea(ip);
        }

        DataSet ds2 = db2.GetIpAddrInfo(ipnum, ip); ;

        if (ds2 != null && ds2.Tables.Count > 0 && ds2.Tables[0].Rows.Count > 0)
        {
            return ds2.Tables[0].Rows[0][0].ToString();
        }

        return "尚无记录";
    }