Why do I receive a 'General error' when trying to use INSERT with Database Toolbox 3.0 (R14)?
1 次查看(过去 30 天)
显示 更早的评论
I am using INSERT to add a row to one of the tables in a database. This works the first time I call INSERT, but subsequent calls result in an error message. For example, my first call is:
insert(conn,'productTable',{'productNumber','unitCost'},{1004,3.45});
This call works, but subsequent calls to INSERT result in the following error:
??? Error using ==> database.insert
General error
采纳的回答
MathWorks Support Team
2009-6-27
This error results when the database has a primary key and you try to insert a row with a non-unique primary key. A primary key is a unique identifier in a table and prevents a row from being inserted that has the same primary key value as another row. A primary key can include values from one or more fields. When you try to add a row with a value in the primary key field that is the same as an existing value in a primary key field, the insert fails and an error appears.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Database Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!