Rex_Beginner
Member
- Joined
- Jan 23, 2009
- Messages
- 5
- Programming Experience
- Beginner
I have a variable named SelectedOwner
dim SelectedOwner as int16
I have a query defined as a method attached to the PersonTableAdapter named GETOWNER()
- here's the query code attached to the PersonTableAdapter
GETOWNER(@PRidnumber)
SELECT PRIDNumber, PRFirstName, PRMiddleName, PRLastName, PRAddress, PRAddress2, PRCity, PRState, PRZipCode, PRPhone, PRPhone2, PREmail,
PRWebsite, PREname, PREPhone
FROM Person
WHERE (PRIDNumber = @pridnumber) AND (PRDesignation = 'OWNER')
In my code I display a message box showing the owner they've selected from the gridview on the previous form
The messagebox correctly displays the selected owner
MsgBox("You selected to Change Owner Number: " & stringtext)
SelectedOwner = CInt(stringtext)
The fields on my form are bound to the table adapter correctly
I then execute the following
PersonTableAdapter.GetOwnerRcd(SelectedOwner)
here is the message I'm getting.
'ConstraintException was unhandled'
'Failed to enable constraints.
'One or more rows contain values violating non-null, unique, or foreign-key constraints.
I would understand this message if I were trying to insert a row into the table with a non-unique primary key but
the only thing my query does is select data and return a row. What am I missing. I'm really new at Visual Basic
VB studio also.
Any help would be appreciated.
Thanks
dim SelectedOwner as int16
I have a query defined as a method attached to the PersonTableAdapter named GETOWNER()
- here's the query code attached to the PersonTableAdapter
GETOWNER(@PRidnumber)
SELECT PRIDNumber, PRFirstName, PRMiddleName, PRLastName, PRAddress, PRAddress2, PRCity, PRState, PRZipCode, PRPhone, PRPhone2, PREmail,
PRWebsite, PREname, PREPhone
FROM Person
WHERE (PRIDNumber = @pridnumber) AND (PRDesignation = 'OWNER')
In my code I display a message box showing the owner they've selected from the gridview on the previous form
The messagebox correctly displays the selected owner
MsgBox("You selected to Change Owner Number: " & stringtext)
SelectedOwner = CInt(stringtext)
The fields on my form are bound to the table adapter correctly
I then execute the following
PersonTableAdapter.GetOwnerRcd(SelectedOwner)
here is the message I'm getting.
'ConstraintException was unhandled'
'Failed to enable constraints.
'One or more rows contain values violating non-null, unique, or foreign-key constraints.
I would understand this message if I were trying to insert a row into the table with a non-unique primary key but
the only thing my query does is select data and return a row. What am I missing. I'm really new at Visual Basic
VB studio also.
Any help would be appreciated.
Thanks