Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 未通过ODBC触发的触发器_C#_Odbc_Oledb_Visual Foxpro - Fatal编程技术网

C# 未通过ODBC触发的触发器

C# 未通过ODBC触发的触发器,c#,odbc,oledb,visual-foxpro,C#,Odbc,Oledb,Visual Foxpro,我在C#中有一个类试图使用OleDB删除FoxPro DBF文件中的记录。我可以毫无问题地添加记录,但是当我要删除“Trigger Failed In Cntref1”(触发器在Cntref1中失败),而Cntref1正是我试图从中删除的表时,会出现以下错误 这里是C#方法 construcd是7,它确实存在,whatFile是正确的表Cntref1 有人知道我收到此错误的原因吗?上面写着“CNtref1中的触发器失败”。你检查过触发器代码包含什么吗?它可能是一个引用完整性触发器,其中包含防止在

我在C#中有一个类试图使用OleDB删除FoxPro DBF文件中的记录。我可以毫无问题地添加记录,但是当我要删除“Trigger Failed In Cntref1”(触发器在Cntref1中失败),而Cntref1正是我试图从中删除的表时,会出现以下错误

这里是C#方法

construcd是7,它确实存在,whatFile是正确的表Cntref1


有人知道我收到此错误的原因吗?

上面写着“CNtref1中的触发器失败”。你检查过触发器代码包含什么吗?它可能是一个引用完整性触发器,其中包含防止在子表中存在行时删除父行的代码。顺便说一句,它将是ExecuteOnQuery(),您不需要参数。Clear();
    private bool DeleteContractRefDBF(int contractID, string whatFile)
    {
        MessageBox.Show(contractID.ToString());
        MessageBox.Show(whatFile);
        try
        {
            string constr = ConfigurationManager.ConnectionStrings["dbfString"].ConnectionString;
            using (OleDbConnection dbfCon = new OleDbConnection(constr))
            {
                dbfCon.Open();
                var dbfCmd = new OleDbCommand("DELETE FROM ? WHERE cr1_id=?", dbfCon);
                dbfCmd.Parameters.Clear();
                dbfCmd.Parameters.AddWithValue("@whatFile", whatFile);
                dbfCmd.Parameters.AddWithValue("@contractID", contractID);
                dbfCmd.ExecuteScalar();
                return true;
            }
        }
        catch (OleDbException ex)
        {
            MessageBox.Show("Error Updating DBF (Show Dan): " + ex);
            return false;
        }
    }