从 C# 通过 OLEDB 执行更新时出错

发布于 2024-09-08 05:14:52 字数 676 浏览 0 评论 0原文

我正在使用 OLEDB 从 C# 更新 .dbf 数据库中的数据。

我在 ExecuteNonQuery 上收到错误:System.Data.OleDb.OleDbException {“表达式中未定义的函数‘替换’。”}。

我怎样才能以最少的改变来完成这项工作,我需要在许多文件中用单引号替换双引号,所以我必须自动化这个过程。

我应该尝试 ODBC 还是其他 .dbf 数据库?

请帮忙!

string connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + directory +";Extended Properties=dBASE III;";
OleDbConnection conn = new OleDbConnection(connString);
conn.Open();
OleDbCommand cmd = conn.CreateCommand();
cmd.CommandType = System.Data.CommandType.Text;
cmd.CommandText = "update Addres_1  set NAME_ENU = replace(NAME_ENU, 'a',   'b') where NAME_ENU like '*a*'";
int res = cmd.ExecuteNonQuery();

I am using OLEDB to Update data in .dbf database from c#.

I get Error: System.Data.OleDb.OleDbException {"Undefined function 'replace' in expression."} on ExecuteNonQuery.

How can I make this work with least changes, i need to replace double quotes with single quotes in many files, so i have to automate this process.

Should I try ODBC or something else for .dbf database?

Help please!

string connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + directory +";Extended Properties=dBASE III;";
OleDbConnection conn = new OleDbConnection(connString);
conn.Open();
OleDbCommand cmd = conn.CreateCommand();
cmd.CommandType = System.Data.CommandType.Text;
cmd.CommandText = "update Addres_1  set NAME_ENU = replace(NAME_ENU, 'a',   'b') where NAME_ENU like '*a*'";
int res = cmd.ExecuteNonQuery();

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沉默的熊 2024-09-15 05:14:52

使用的数据提供程序不支持替换。
如果我发现如何在大型数据集上以快速而简单的方式执行此操作,我将更新答案。

Replace is not supported by used data provider.
I will update answer if and when i find out how to do this in fast and simple way on large dataset.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文