I have "index" changed from Primary to Not Primary with a Null
It keeps giving me an error in "cmd.ExecuteNonQuery()".
The error statement is:
"Violation of PRIMARY KEY constraint 'PK_Checking'. Cannot insert duplicate key in object 'dbo.Checking'. The duplicate key value is (1).
The statement has been terminated."
I also have tried putting the Primary Key back on and deleting all the references to the "index".
Sub Insert()
For k = 1 to 100
cmdStr = "INSERT INTO [Checking] ([index], [DatePaid],[WhatPaid],[AmtPaid],[Total],[AmtRec],[WhatRec],[DateRec]) VALUES (@index, @DatePaid, @WhatPaid, @AmtPaid, @Total, @AmtRec, @WhatRec, @DateRec);"
Using conn As New SqlConnection(connStr)
conn.Open()
Using cmd As New SqlCommand(cmdStr, conn)
cmd.Parameters.AddWit ...
Go to the complete details ...