非常怪的问题(可能是工具的 BUG),还请各位大侠近来看指点,

// 给出两段代码 CS程序 方法1成功,方法2失败
1。直接在窗体下写成功
SqlCeConnection cn= new SqlCeConnection(@"Data Source =\My Documents\gatheringService.sdf");
if (cn.State==ConnectionState.Closed)
cn.Open();
string sSQL="select customerId ,customerName from customerInfo ";
SqlCeCommand cmdSelect=new SqlCeCommand(sSQL,cn);
SqlCeDataReader dtr=cmdSelect.ExecuteReader(CommandBehavior.Default);
this.comboBox1.Items.Clear();
//this.comboBox1.DataSource = dtr;
//this.comboBox1.DisplayMember="customerName";
//this.comboBox1.ValueMember ="customerId";
while (dtr.Read())
{
this.comboBox1.Items.Add(dtr[0].ToString());
}
cn.Close()
/////////////////////////////////////////////
2。调用方法
public static SqlCeDataReader ExecSql(string strSql)
{
SqlCeDataReader dtr= null;
SqlCeConnection cn= new SqlCeConnection(@"Data Source =\My Documents\gatheringService.sdf");
try
{

if (cn.State==ConnectionState.Closed)
cn.Open();
//string sSQL="select customerId ,customerName from customerInfo ";
SqlCeCommand cmdSelect=new SqlCeCommand(strSql,cn);
dtr=cmdSelect.ExecuteReader(CommandBehavior.Default);
}
catch(SqlCeException ex)
{
throw ex;

}
finally
{
cn.Close();
}
return dtr;
}

string sSQL="select customerId ,customerName from customerInfo ";
SqlCeDataReader dtr = database.ExecSql(sSQL);
this.comboBox1.Items.Clear();
//this.comboBox1.DataSource = dtr;
//this.comboBox1.DisplayMember="customerName";
//this.comboBox1.ValueMember ="customerId";
while (dtr.Read())
{
this.comboBox1.Items.Add(dtr[0].ToString());
}
错误信息 未处理的“System.InvalidOperationException”类型的异常出现在 System.Data.SqlServerCe.dll 中。

其他信息: 无法找到资源程序集

备注:开发环境VS2003 + SQL SERVER CE2。0 PDA HP1950 WIN MOBILE 5。0
什么原因了

[1997 byte] By [smallMage-小马哥] at [2008-6-5]
# 1
真正的信息在 ex.InnerException 下面。
# 2
还有啊,都关闭连接了,返回的DataReader在读取数据的时候应该会垮掉。
# 3
楼上的应该怎么写了
smallMage-小马哥 at 2007-10-25 > top of Msdn China Tech,.NET技术,C#...