This problem is killing me!
What I have doen si greatly simplified the problem and cast it into MS Access (instead of MS SQL from whence it sources) to allow easy distibution.
A zip file with the database and all vb.net files can be found at The file is a measily 13.4 kB.
Here is the code that causes the problem:
Private Sub cmdTest
Dim conTestTable As New OleDbConnection(conString)
Dim da As OleDbDataAdapter = New OleDbDataAdapter("Select * from BADGECOPY", conTestTable)
Dim dt As New DataTable
da.Fill(dt)
' Set up the ID column as the primary key
Dim pk(0) As DataColumn
pk(0) = dt.Columns("ID"
dt.PrimaryKey = pk <<=== here is the problem
End Sub
When the indicated line is executed, I get the following error:
An unhandled exception of type 'System.ArgumentException' occurred in system.data.dll
Additional information: These columns don't currently have unique values.
The column ID is an array of bytes. The sample database has exactly two rows and the ID's are unique.
I could really use help on this one! Thanks!
----
Gerry Roston
gerry@pairofdocs.net
What I have doen si greatly simplified the problem and cast it into MS Access (instead of MS SQL from whence it sources) to allow easy distibution.
A zip file with the database and all vb.net files can be found at The file is a measily 13.4 kB.
Here is the code that causes the problem:
Private Sub cmdTest
Dim conTestTable As New OleDbConnection(conString)
Dim da As OleDbDataAdapter = New OleDbDataAdapter("Select * from BADGECOPY", conTestTable)
Dim dt As New DataTable
da.Fill(dt)
' Set up the ID column as the primary key
Dim pk(0) As DataColumn
pk(0) = dt.Columns("ID"
dt.PrimaryKey = pk <<=== here is the problem
End Sub
When the indicated line is executed, I get the following error:
An unhandled exception of type 'System.ArgumentException' occurred in system.data.dll
Additional information: These columns don't currently have unique values.
The column ID is an array of bytes. The sample database has exactly two rows and the ID's are unique.
I could really use help on this one! Thanks!
----
Gerry Roston
gerry@pairofdocs.net