473,386 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Confussing error .. help needed

when I load a form I create a dateaset using
(part of sub )
Orig_Accounts = GetSQLDataSet("EXEC
BossData.dbo.SQL2005_ORIGACCOUNTS", "TBL_OrigAccounts")
' Set Primary Keys
SearchKey(0) =
Orig_Accounts.Tables("TBL_OrigAccounts").Columns(" tblOA_Licence")
SearchKey(1) =
Orig_Accounts.Tables("TBL_OrigAccounts").Columns(" tblOA_AccountID")
Orig_Accounts.Tables("TBL_OrigAccounts").PrimaryKe y = SearchKey

(end part of sub )

I then call SearchRecord using LicenceNumber & "001" to display the 1st
account for that licence number. this all works fine. I load all the account
id's ( 001,002 003 etc ) into a combobox using the sub LoadcmboAccountID.
The idea is that the operator can use the combobox and select an account id
it will display that record. However when the use selects an Id and i call
the SearchRecord(sLicence, cmboAccountID.Text) sub , SLicence being the
licence number and cmboAccountID.Text being the selected ID from the combo
list. I keep getting this error

Column 'tblOA_Licence, tblOA_AccountID' is constrained to be unique. Value
'217514, 005' is already present.

and i dont understand why... the sub works fine when the form is loaded,
but as soon as you try and use it a second time you get that error. Stepping
through the code it is causing an error at the
Manager.Position = ACTIVEROW line, any ideas why ?

SUB

Private ACTIVEROW As Integer = 0
Private SearchRow As DataRow
Dim FindMatch(1) As Object
Private Sub SearchRecord(ByVal Licence As String, ByVal AccountID As
String)
Try
FindMatch(0) = Licence
FindMatch(1) = AccountID
SearchRow =
Orig_Accounts.Tables("TBL_OrigAccounts").Rows.Find (FindMatch)
ACTIVEROW = CInt(SearchRow("idCol").ToString)
If ACTIVEROW 0 Then
LoadControls(ACTIVEROW)
Manager.Position = ACTIVEROW
End If
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
End Sub

Private Sub LoadcmboAccountID()
SQL_COMMAND.CommandText = "Select TblOA_AccountID from
Bossdata.dbo.OriginatingAccounts where tbloa_licence = '" & sLicence & "'
Order by Tbloa_AccountId"
SQL_COMMAND.Connection = BOSSSQLCONNECTION
SQL_DATAREADER = SQL_COMMAND.ExecuteReader
Do While SQL_DATAREADER.Read
If SQL_DATAREADER.GetString(0) cmboAccountID.Text Then
cmboAccountID.Items.Add(SQL_DATAREADER.GetString(0 ))
End If
Loop
End Sub

Jul 23 '06 #1
1 1022
Peter Newman wrote:
>
Column 'tblOA_Licence, tblOA_AccountID' is constrained to be unique. Value
'217514, 005' is already present.
On casual inspection of your code, I can't see what might be causing
that exception. But apparently you have a unique constraint on the
License and AccountID columns of your table and for some reason you are
inserting another record with that same combination of License and
AccountID.

You will have to figure out why you are inserting a new record with
those same values.

Jul 24 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Brian | last post by:
Does anyone know what the error message: the callee(server(not server application) is not available and disappeared; all connections are invalid. The call did noot execute. means? I get this...
2
by: Steve Richfield | last post by:
My error handler works GREAT. However, VBA seems to have some bugs/features that are causing it fits. The little snippet that I put at the end of each routine looks like this: Error_Handler: If...
16
by: TD | last post by:
This is the code under a command button - Dim ctl As Control For Each ctl In Me.Controls If ctl.BackColor <> RGB(255, 255, 255) Then ctl.BackColor = RGB(255, 255, 255) End If Next ctl
16
by: lawrence k | last post by:
I've made it habit to check all returns in my code, and usually, on most projects, I'll have an error function that reports error messages to some central location. I recently worked on a project...
1
by: AMP | last post by:
I have a statement: if ((error = bslTxRx(BSL_MERAS, /* Command: Mass Erase */ 0xff00, /* Any address within flash memory. */ 0xa506, /* Required setting for mass erase! */ null, blkin)) !=...
13
by: Albert | last post by:
Hi I'm using the lcc compiler for win32. I tried compiling a program but there's an error stating: "cpp: Can't open input file clrscr()" I don't get it - I've included <tcconio.h>. (strange why...
0
by: =?Utf-8?B?VmFuZXNzYQ==?= | last post by:
Hi all! I am having problems on installing .NET Framework 3.5 on some machines. In one machine the error is: WinVerifyTrust returned -2146762751 Wintrust not on machine Error: O arquivo...
3
by: =?Utf-8?B?VmFuZXNzYQ==?= | last post by:
Hi all! I am having problems on installing .NET Framework 3.5 on some machines. In one machine the error is: '.NET Framework 3.5' RunCheck result: Install Needed Verifying file integrity of...
2
by: akhilesh.noida | last post by:
I am trying to compile glibc-2.5 for ARM based board. But I am getting errors while configuring it. Please check and give your inputs for resolving this. configure command : $...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.