IErrorInfo.GetDescription 失败 E_FAIL(0x80004005) C#
IErrorInfo.GetDescription failed with E_FAIL(0x80004005) C#
我得到一个
IErrorInfo.GetDescription failed with E_FAIL(0x80004005)
而且我不知道这意味着什么,也不知道如何解决。当我将 accact 查询复制并粘贴到我的 Acces-db 和 运行 时,它就像一个魅力,但是当我尝试 运行 它在 c# 中时,我得到了这个错误。
所有参数都填充了正确的值。
@aankomst = 15-11-2017, @vertrek = 20-11-2017, @grootte = "large"
try
{
standplaatslijst.Clear();
verbinding = new OleDbConnection(
@"Provider=Microsoft.ACE.OLEDB.12.0;
Data Source=..\..\..\La_Rustique.accdb;
Persist Security Info=False;");
verbinding.Open();
OleDbCommand query = new OleDbCommand();
OleDbDataReader lezer = null;
query.CommandText = @"SELECT *
FROM standplaats
WHERE id not in (SELECT standplaats_id
FROM reservering
WHERE @aankomst BETWEEN aankomst AND vertrek
AND @vertrek BETWEEN aankomst AND vertrek)
AND size = @grootte";
query.Connection = verbinding;
query.Parameters.Add(new OleDbParameter("@aankomst", OleDbType.DBDate));
query.Parameters["@aankomst"].Value = aankomst;
query.Parameters.Add(new OleDbParameter("@vertrek", OleDbType.DBDate));
query.Parameters["@vertrek"].Value = vertrek;
query.Parameters.Add(new OleDbParameter("@grootte", OleDbType.VarChar));
query.Parameters["@grootte"].Value = grootte;
lezer = query.ExecuteReader();
while (lezer.Read())
{
standplaatslijst.Add(new standplaats(lezer));
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
verbinding.Close();
}
我正在将 reader 添加到一个名为 standplaats 的新 class 中,它看起来像这样:
public standplaats(OleDbDataReader lezer)
{
_id = lezer.GetInt32(0);
Grootte = lezer.GetString(1);
Name = lezer.GetString(2);
}
SIZE
是 MS Access 中的保留字。
将查询更改为:
query.CommandText = @"SELECT *
FROM standplaats
WHERE id not in (SELECT standplaats_id
FROM reservering
WHERE @aankomst BETWEEN aankomst AND vertrek
AND @vertrek BETWEEN aankomst AND vertrek)
AND [size] = @grootte";
Here你找到保留字列表。
我得到一个
IErrorInfo.GetDescription failed with E_FAIL(0x80004005)
而且我不知道这意味着什么,也不知道如何解决。当我将 accact 查询复制并粘贴到我的 Acces-db 和 运行 时,它就像一个魅力,但是当我尝试 运行 它在 c# 中时,我得到了这个错误。
所有参数都填充了正确的值。
@aankomst = 15-11-2017, @vertrek = 20-11-2017, @grootte = "large"
try
{
standplaatslijst.Clear();
verbinding = new OleDbConnection(
@"Provider=Microsoft.ACE.OLEDB.12.0;
Data Source=..\..\..\La_Rustique.accdb;
Persist Security Info=False;");
verbinding.Open();
OleDbCommand query = new OleDbCommand();
OleDbDataReader lezer = null;
query.CommandText = @"SELECT *
FROM standplaats
WHERE id not in (SELECT standplaats_id
FROM reservering
WHERE @aankomst BETWEEN aankomst AND vertrek
AND @vertrek BETWEEN aankomst AND vertrek)
AND size = @grootte";
query.Connection = verbinding;
query.Parameters.Add(new OleDbParameter("@aankomst", OleDbType.DBDate));
query.Parameters["@aankomst"].Value = aankomst;
query.Parameters.Add(new OleDbParameter("@vertrek", OleDbType.DBDate));
query.Parameters["@vertrek"].Value = vertrek;
query.Parameters.Add(new OleDbParameter("@grootte", OleDbType.VarChar));
query.Parameters["@grootte"].Value = grootte;
lezer = query.ExecuteReader();
while (lezer.Read())
{
standplaatslijst.Add(new standplaats(lezer));
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
verbinding.Close();
}
我正在将 reader 添加到一个名为 standplaats 的新 class 中,它看起来像这样:
public standplaats(OleDbDataReader lezer)
{
_id = lezer.GetInt32(0);
Grootte = lezer.GetString(1);
Name = lezer.GetString(2);
}
SIZE
是 MS Access 中的保留字。
将查询更改为:
query.CommandText = @"SELECT *
FROM standplaats
WHERE id not in (SELECT standplaats_id
FROM reservering
WHERE @aankomst BETWEEN aankomst AND vertrek
AND @vertrek BETWEEN aankomst AND vertrek)
AND [size] = @grootte";
Here你找到保留字列表。