首页 新闻 会员 周边 捐助

winform控件使用数据库层的问题

0
悬赏园豆:30 [已解决问题] 解决于 2008-01-25 10:24
我写了个winform的用户控件,里面调用了用企业库写的dal方法,比如getNamebyId之类的,然后编后后拖入其他winform窗口里面报错,怎么回事?<br> <br> <br> using System;<br> using System.Collections.Generic;<br> using System.ComponentModel;<br> using System.Drawing;<br> using System.Data;<br> using System.Text;<br> using System.Windows.Forms;<br> using Haoting.DAL;<br> using Haoting.BLL;<br> <br> namespace Haoting.UI<br> {<br> &nbsp;&nbsp;&nbsp; public partial class UserControl1 : UserControl<br> &nbsp;&nbsp;&nbsp; {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public UserControl1()<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; InitializeComponent();<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ProjectManager pm = new ProjectManager();<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; label1.Text = pm.GetById("{8676E22F-1B62-4760-BF33-B8D44D4BB634}").Tables[0].Rows[0][0].ToString();<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &nbsp;&nbsp;&nbsp; }<br> }<br> 报错的图:<br> <img src="http://www.cnblogs.com/images/cnblogs_com/emilchan/121285/r_userCerr.jpg" alt="" border="0">
超晨的主页 超晨 | 初学一级 | 园豆:0
提问于:2008-01-24 22:23
< >
分享
最佳答案
0
请试一下下面的代码,如果还不行,请看一下这里: http://www.cnblogs.com/deerchao/archive/2007/11/06/950675.html namespace Haoting.UI { public partial class UserControl1 : UserControl { public UserControl1() { InitializeComponent(); if(!DesignMode) { ProjectManager pm = new ProjectManager(); label1.Text = pm.GetById("{8676E22F-1B62-4760-BF33-B8D44D4BB634}").Tables[0].Rows[0][0].ToString(); } } } }
deerchao | 大侠五级 |园豆:8367 | 2008-01-25 00:26
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册