{
Info = BLL.T_message.GetInstance().GetMessageById(id);
DataRow dr = Info.Rows[0];
string InputUserName = this.InputUserNameText.Value;
}
以及
if (string.IsNullOrEmpty(id) == false)
{
rst = BLL.T_message.GetInstance().UpdateMessageById(id,TaskID, InputUserID, InputUserName, InputDate, ReceiveTel, MsgContent, SendMaxNum, IsReceived);
}
else
{
rst = BLL.T_message.GetInstance().InsertMessage(TaskID,InputUserID, InputUserName, InputDate, ReceiveTel, MsgContent, SendMaxNum, IsReceived);
}
Response.Write("<script>alert('" + rst + "')</script>");
}
分别为了实现什么?与数据库有关吗?(TaskID,InputUserID, InputUserName, InputDate, ReceiveTel, MsgContent, SendMaxNum, IsReceived为数据库中的列名)
------解决方案--------------------------------------------------------
if else 分别实现了对数据库某条记录的修改和添加操作
只不过是调用了业务逻辑层的两个方法,而这两个方法最终会调用数据库访问层的修改和添加方法,从而实现对数据库该记录的更新操作
------解决方案--------------------------------------------------------
很简单的
{
Info = BLL.T_message.GetInstance().GetMessageById(id);
DataRow dr = Info.Rows[0];
string InputUserName = this.InputUserNameText.Value;
}
这个是 获取一个BLL.T_message的实例,然后取它的第一行,第3句,应该是取用户名。
下面代码只解释一句,其他都大同小异
rst = BLL.T_message.GetInstance().UpdateMessageById(id,TaskID, InputUserID, InputUserName, InputDate, ReceiveTel, MsgContent, SendMaxNum, IsReceived);
创建BLL.T_message.GetInstance()实例(BLL.T_message),调用BLL.T_message实例方法UpdateMessageById执行更新数据