| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 435 人关注过本帖
标题:这一段代码,求高手帮忙看一下
只看楼主 加入收藏
wangxinsy
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2010-3-25
结帖率:0
收藏
已结贴  问题点数:20 回复次数:2 
这一段代码,求高手帮忙看一下
数据层是:


namespace DAL
{
    public  class ManageInfoDal
    {
        private SQLHelper sqlhelper = null;
        public ManageInfoDal()
        {
            sqlhelper = new SQLHelper();
        }
        
        public DataTable GetManageInfo(string Plcid)
        {
            string sql = "select * from [mission] where [Plcid] = '"+Plcid+"' ";
            try
            {
                DataTable dt = sqlhelper.ExecuteQuery(sql, CommandType.Text);
                return dt;
            }
            catch (Exception ee)
            {
               
                throw ee;
            }
        }

        public bool UpdateInfo(ComputerInfo cif, string id)
        {
            string sql = "UPDATE newssystem.dbo.mission SET TaskName='" + cif.TaskName + "',Units='" + cif.Units + "',StartTime='" + cif.StartTime + "',EndTime='" + cif.EndTime + "',Content='" + cif.Content + "' WHERE Plcid='" + cif.Plcid + "'and id='" + id + "'";
            try
            {
                int n = sqlhelper.ExecuteNonQuery(sql, CommandType.Text);
                if (n>0)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            catch (Exception ex)
            {
               
                return false;
            }
        }
    }
}
业务层是:
namespace BLL
{
    public class ManageInfoBll
    {
        private ManageInfoDal mid = new ManageInfoDal();
        
        public DataTable GetComputerInfoByMan(string Plcid)
        {
            try
            {
                DataTable dt = mid.GetManageInfo(Plcid);
                return dt;
            }
            catch (Exception ee)
            {
               
                throw ee;
            }
        }
        public bool UpdateComputer(ComputerInfo cif, string id)
        {
            try
            {
                bool alyreadyup = mid.UpdateInfo(cif, id);
                return alyreadyup;
            }
            catch (Exception ex)
            {

                return false;;
            }
        }
    }
}
事件:

public partial class Manage : System.Web.UI.Page
{
    public string gcode = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        gcode = Request["xcode"];
        if (!IsPostBack && !IsCallback)
        {
            if (Session["user"] != null)
            {
                ManageInfoBll mib = new ManageInfoBll();
                DataTable dt = mib.GetComputerInfoByMan(gcode);
                this.GridView1.DataSource = dt;
                GridView1.DataBind();
            }
            else
            {
                Response.Redirect("default.aspx");
            }

        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {

    }
}

报"**"附近有语法错误
搜索更多相关主题的帖子: 代码 
2010-03-25 20:12
aspic
Rank: 17Rank: 17Rank: 17Rank: 17Rank: 17
等 级:贵宾
威 望:51
帖 子:2258
专家分:8050
注 册:2008-2-18
收藏
得分:20 
没报具体的行?
2010-03-26 08:52
风笑痴
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2010-4-1
收藏
得分:0 
哪里看到那个报**的地方啊。
2010-04-02 10:02
快速回复:这一段代码,求高手帮忙看一下
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.024932 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved