我写了个winform的用户控件,里面调用了用企业库写的dal方法,比如getNamebyId之类的,然后编后后拖入其他winform窗口里面报错.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using Haoting.DAL;
using Haoting.BLL;
namespace Haoting.UI
{
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
ProjectManager pm = new ProjectManager();
label1.Text = pm.GetById("{8676E22F-1B62-4760-BF33-B8D44D4BB634}").Tables[0].Rows[0][0].ToString();
}
}
}
报错的图:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using Haoting.DAL;
using Haoting.BLL;
namespace Haoting.UI
{
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
ProjectManager pm = new ProjectManager();
label1.Text = pm.GetById("{8676E22F-1B62-4760-BF33-B8D44D4BB634}").Tables[0].Rows[0][0].ToString();
}
}
}
报错的图:
最后得出结论,控件出问题了