首页上一页 1 下一页尾页 1 条记录 1/1页
关于《网络编程自学手册》bbs论坛部份
发表在ASP.NET图书答疑
2008-11-25
是否精华
是
否
版块置顶:
是
否
为显示客户端IP,我先在CarManage.cx中增加
private string ip = "";
/// <summary>
/// card_ip
/// </summary>
public string ip
{
get { return ip; }
set { ip = value; }
}
public int AddCard(CardManage cardmanage)
{
SqlParameter[] prams = {
data.MakeInParam("@cardid", SqlDbType.NVarChar, 50, cardmanage.CardID),
data.MakeInParam("@cardname", SqlDbType.NVarChar, 1000, cardmanage.CardName),
data.MakeInParam("@moduleid", SqlDbType.NVarChar, 50,cardmanage.ModuleID),
data.MakeInParam("@cardcontent", SqlDbType.NVarChar, 4000, cardmanage.CardContent),
data.MakeInParam("@cardtime", SqlDbType.SmallDateTime, 8, cardmanage.CardTime),
data.MakeInParam("@cardpeople", SqlDbType.NVarChar, 50, cardmanage.CardPeople),
data.MakeInParam("@pop", SqlDbType.NChar, 10, cardmanage.Pop),
data.MakeInParam("@ip", SqlDbType.NVarChar, 50, cardmanage.ip),
};
return (data.RunProc("INSERT INTO tb_Card (帖子编号,帖子名称,版块编号,帖子内容,发表时间,发帖人,角色,card_ip) VALUES (@cardid,@cardname,@moduleid,@cardcontent,@cardtime,@cardpeople,@pop,@ip)", prams));
}
然后在delivercard.aspx中加入
cardmanage.ip = Session["IP"].ToString();
(先已声明: Session["IP"] = Request.UserHostAddress.ToString();)
有下面文句时,
/// <summary>
/// card_ip
/// </summary>
public string ip
{
get { return ip; }
set { ip = value; }
}
提示:“CardManage”已经包含“ip”的定义
无上面语句时:
提示:“CardManage”并不包含“ip”的定义
为什么?
private string ip = "";
/// <summary>
/// card_ip
/// </summary>
public string ip
{
get { return ip; }
set { ip = value; }
}
public int AddCard(CardManage cardmanage)
{
SqlParameter[] prams = {
data.MakeInParam("@cardid", SqlDbType.NVarChar, 50, cardmanage.CardID),
data.MakeInParam("@cardname", SqlDbType.NVarChar, 1000, cardmanage.CardName),
data.MakeInParam("@moduleid", SqlDbType.NVarChar, 50,cardmanage.ModuleID),
data.MakeInParam("@cardcontent", SqlDbType.NVarChar, 4000, cardmanage.CardContent),
data.MakeInParam("@cardtime", SqlDbType.SmallDateTime, 8, cardmanage.CardTime),
data.MakeInParam("@cardpeople", SqlDbType.NVarChar, 50, cardmanage.CardPeople),
data.MakeInParam("@pop", SqlDbType.NChar, 10, cardmanage.Pop),
data.MakeInParam("@ip", SqlDbType.NVarChar, 50, cardmanage.ip),
};
return (data.RunProc("INSERT INTO tb_Card (帖子编号,帖子名称,版块编号,帖子内容,发表时间,发帖人,角色,card_ip) VALUES (@cardid,@cardname,@moduleid,@cardcontent,@cardtime,@cardpeople,@pop,@ip)", prams));
}
然后在delivercard.aspx中加入
cardmanage.ip = Session["IP"].ToString();
(先已声明: Session["IP"] = Request.UserHostAddress.ToString();)
有下面文句时,
/// <summary>
/// card_ip
/// </summary>
public string ip
{
get { return ip; }
set { ip = value; }
}
提示:“CardManage”已经包含“ip”的定义
无上面语句时:
提示:“CardManage”并不包含“ip”的定义
为什么?