Thanx Bob I have seen my error I had to close the
connection before sending the id again and looping around
the for next cycle,this has allowed it to parse the same
id again thanks for the help all
>I suggest you use SQL Profiler to determine what that exe
is doing. It may
>be dropping the constraint before adding the dup record
(although this seems
Quote:>unlikely since you are able to manually add the records
via MsQry32 - you
>should turn on profiler to see what happens when you
insert the dup records
>via this method also).
>If that doesn't get you anywhere, could you please post
the table creation
>script (edit out the irrelevant columns please - we don't
need to wade
>through all 50+ lines of a script to see how constraints
are being created).
>Also provide us with some "Insert ...Values" statements.
This will help us
>reproduce the problem and see what's happening.
>> The exe does add duplicates in the primary key column
>> problem is I dont Know how as I dont have sorce code
>> so it appears that this can be done except how and what
>> can be done to achieve this. any ideas will be graetlkey
>> >-----Original Message-----
>> >Are you saying that your compiled exe is adding the
>> >value in the PK column for > 1 record?
>> >And that "I can manualy add it direct in sqlmngr or
>> >running MsQry32,without any error"... ?
>> >Primary Key columns DO NOT except duplicate key values,
>> >regardless of how you try to add it.
>> >If it's a problem w/ your ado code, and your query is
>> >passing a unique value to the PK column - and failing
>> >because of PK constraint error, you need to double
>> >your values.
>> >In your code snippet, what are you doing w/ the lvw and
>> >CN? Check out my ado conn object on my website...
>> >MCDBA MCSE
>> >>-----Original Message-----
>> >>I have A sql db that has a transactions table,I have a
>> >>that writes to this table and uses the same
>> >>more than once in the primary key column, this works
>> >>but dont have the sorce code to this prog.
>> >>So I wrote my own using vb6 and when I try to insert
>> >>the field I get the following error.
>> >>Violation of PRIMARY KEY
>> >constraint 'aaaaaTransaction_PK'.
>> >>Cannot insert duplicate key in
>> object 'TransactionItems'.-
>> >>I can manualy add it direct in sqlmngr or running
>> >>MsQry32,without any error, but if I use code it
>> >>wont take it.
>> >>heres abit of the code I use to give idea where I
>> >>going wrong.
>> >>Dim CN As New ADODB.Connection
>> >>Dim RS As New ADODB.Recordset
>> >>Set lvw = Till_Module.ListView1
>> >> CN = ReadWriteINI("GET", "DKPOS SETTINGS", "CN")
>> >>SQL2 = "INSERT INTO TransactionItems
>> >>(TransactionID,ItemID, ItemQTY) " _
>> >>& "VALUES ('" & uniqueID & "','" & li.SubItems(7)
>> & "','"
>> >>& li.SubItems(2) & "')"
>> >>For j = 1 To Till_Module.ListView1.ListItems.Count
>> >>Set li = Till_Module.ListView1.ListItems.Item(j)
>> >>CN.Execute (SQL2)
>> >>There has to be a way for this to work please help me
>> >>Many Thanx