经过大量使用后,“找不到数据库”

时间:2013-09-09 21:01:58

标签: sql-server-ce

我发现当我在本地SQL CE数据库中进行大量插入时,它似乎崩溃并停止接受新请求。我在forloop中做了大约800次的更新(但不是那么多),当我去使用同时填充数据表的数据时(我正在使用委托和工作项(System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(ProcessRowObject), id);),

在工作人员停止的地方我获得The database file cannot be found. Check the path to the database. [ Data Source = ],即使我创建连接时使用

string cnnString = "Data Source=C:/Fastway/Database/Database.sdf";
SqlCeConnection Connection = new SqlCeConnection(cnnString);

当我执行命令时,我使用:

DataAdapter = new SqlCeDataAdapter("", Connection);
var ret = new DataTable();
if (timeOut != 30)
{ //if the DBCon is part of a transaction that already has a timeout set, it keeps getting hosed here.
    db.DataAdapter.SelectCommand.CommandTimeout = timeOut;
}

if (ParameterConcat)
{
    query = QueryParametersToEmbeddedQuery(query, parameters);
}
else
{
    AddParameters(db.DataAdapter.SelectCommand, parameters);
}

db.DataAdapter.SelectCommand.CommandText = query;
try
{
    db.DataAdapter.Fill(ret);
}
catch (SqlCeException ex)
{
    throw new Exception("SQL query failed: " + query, ex);
}
return ret;

Soooo ....是的。我该怎么办?

0 个答案:

没有答案