我在线程中用ef写sql数据库的exe文件放到服务器就失败呢?
提示:未将对象引用设置到对象的实例
代码:
private bool SaveData(float[] dispVal, ClientDto client)
{
//保存, 判断通道,没有则添加
ExtHost h;
BLL.ExtHostBLL host = new ExtHostBLL();
h = host.GetHostByHostcode(client.HostId);
int channelIndex = 1;
string channelId = "";
foreach (decimal val in dispVal)
{
if (!host.ExistChannel("通道" + channelIndex, h.Id, out channelId))
{
channelId = Common.Result.GetNewId();
host.AddChannel(channelId, "通道" + channelIndex, client.HostId);
}
host.AddChannelData(Common.Result.GetNewId(), channelId, val);
channelIndex++;
}
return true;
}