The changes you requested to the table were not successful

user3479671

Before anyone starts shouting "duplicate", let me say that I've searched for a solution to this problem thoroughly, and found no solutions.

Background info: I'm attempting to inset into a small table in an Access 2003 database from a compiled windows form program (exe) made with Visual Basic 2010 Express.

There are four insert statements performed in this same database, each on a different table, but the first three work without issue, it's the fourth one that throws the error:

cmd = New OleDbCommand("INSERT INTO PrivateTableName 
                        VALUES('" & Serial.Text & "','Pending',
                               '" & coverArea.Text & "','')", myConnection)
Try
     cmd.ExecuteNonQuery()
Catch ex As Exception
     MsgBox("Error attempting to insert into PrivateTableName " & ex.ToString)
     Exit Sub
End Try

I've changed the name of the table for privacy purposes, but rest assured, the table name is irrelevant.

This statement throws the exception

The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship

The error itself is pretty self-explanatory, yet, utterly impossible. Below is a screen shot of the table design

table design

Note that the primary key is not an auto incrementing number. The primary key is a serial number (or rather a string) which is consists of a 5 digit number (which is sequentially indexed from the previous) and two letters which are randomly generated (i.e. 14582KH), and I've verified that the value it attempts to insert as the primary key doesn't already exist.

I've already tried to compact and repair the database, which didn't help. There are no relationships between the fields in this table with fields in other tables, it's completely independent.

Any ideas?

user3479671

Though I'm unsure why it matters, specifying the fields seems to fix the problem.

cmd = New OleDbCommand("INSERT INTO PrivateTableName ([My Order Number],
[BV Order Number], [Area]) VALUES('" & Serial.Text & _ "','Pending'," &
coverArea.Text & ")", myConnection)

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

The page you were looking for doesn't exist

분류에서Dev

Does Control+C delete the files that you were downloading and installing?

분류에서Dev

In GDB, can you set memory as if it were a char array?

분류에서Dev

AffectedRecords property is -1 but no changes in the table?

분류에서Dev

Is there a way to find the URL of a Skype meeting that you were “kicked out” of but never received an invite for?

분류에서Dev

Does height of table changes with more content in rows?

분류에서Dev

Tracking SQL Server Table data changes

분류에서Dev

How to duplicate object in JS where duplicate changes if you change original

분류에서Dev

How you Hide/Show a table's borders in Javascript or JQuery

분류에서Dev

How do you update the last row in a table using SQL in ASP

분류에서Dev

How do you parse a HTML table representing time?

분류에서Dev

In Yii, how do you validate uniqueness against another column in the table?

분류에서Dev

SQL tuning advice requested

분류에서Dev

Requested Resource is not available error

분류에서Dev

Restlet : Requested resource not found

분류에서Dev

Returning string is not successful

분류에서Dev

_grokparsefailure on successful match

분류에서Dev

Automatically renumber records in an Access table after data changes have been made

분류에서Dev

When were background processes invented?

분류에서Dev

CodeIgniter, Requested URL not found on server

분류에서Dev

The requested operation caused a stack overflow

분류에서Dev

Index 2 requested with size of 2

분류에서Dev

HTTP Request from Dockerfile not successful

분류에서Dev

Is there a visual explanation of why data.table operations are faster than tidyverse operations when you need to group by a variable?

분류에서Dev

How to Use MERGE in SQL Server when you have a compound primary key in the source table

분류에서Dev

In the access 2007 append to query designer, can you still use references to form objects in the field table?

분류에서Dev

What are the default values when you don't specify height and width for elements inside a table layout?

분류에서Dev

iptables - why do I get "Table does not exist (do you need to insmod?)"

분류에서Dev

Call a command as if it were in called in another directory

Related 관련 기사

  1. 1

    The page you were looking for doesn't exist

  2. 2

    Does Control+C delete the files that you were downloading and installing?

  3. 3

    In GDB, can you set memory as if it were a char array?

  4. 4

    AffectedRecords property is -1 but no changes in the table?

  5. 5

    Is there a way to find the URL of a Skype meeting that you were “kicked out” of but never received an invite for?

  6. 6

    Does height of table changes with more content in rows?

  7. 7

    Tracking SQL Server Table data changes

  8. 8

    How to duplicate object in JS where duplicate changes if you change original

  9. 9

    How you Hide/Show a table's borders in Javascript or JQuery

  10. 10

    How do you update the last row in a table using SQL in ASP

  11. 11

    How do you parse a HTML table representing time?

  12. 12

    In Yii, how do you validate uniqueness against another column in the table?

  13. 13

    SQL tuning advice requested

  14. 14

    Requested Resource is not available error

  15. 15

    Restlet : Requested resource not found

  16. 16

    Returning string is not successful

  17. 17

    _grokparsefailure on successful match

  18. 18

    Automatically renumber records in an Access table after data changes have been made

  19. 19

    When were background processes invented?

  20. 20

    CodeIgniter, Requested URL not found on server

  21. 21

    The requested operation caused a stack overflow

  22. 22

    Index 2 requested with size of 2

  23. 23

    HTTP Request from Dockerfile not successful

  24. 24

    Is there a visual explanation of why data.table operations are faster than tidyverse operations when you need to group by a variable?

  25. 25

    How to Use MERGE in SQL Server when you have a compound primary key in the source table

  26. 26

    In the access 2007 append to query designer, can you still use references to form objects in the field table?

  27. 27

    What are the default values when you don't specify height and width for elements inside a table layout?

  28. 28

    iptables - why do I get "Table does not exist (do you need to insmod?)"

  29. 29

    Call a command as if it were in called in another directory

뜨겁다태그

보관