注册 登录
编程论坛 ASP.NET技术论坛

这一段代码,求高手帮忙看一下

wangxinsy 发布于 2010-03-25 20:12, 435 次点击
数据层是:


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)
    {

    }
}

报"**"附近有语法错误
2 回复
#2
aspic2010-03-26 08:52
没报具体的行?
#3
风笑痴2010-04-02 10:02
哪里看到那个报**的地方啊。
1