Hello all
excuse for my bad english

I have database in foxpro
tables with unique keys

when i add a record in foxpro i use a fonction to add the new number unique (the standart fonction in the foxpro exemple of database)

but when i 'm under VB.net with oledb
select , update and delete work fine.

i try to make a oledbcommand with insert
i insert all the other rows but not the row of the key row

and the number of this key is always 0
and thus the second insert makes an error because the key are not unique .

Do you have a solution or must i read the number of the key in the other table and add in VBNET

Thanks and good day

Re: vb.net and foxpro 8 by Anders

Anders
Tue Jun 29 14:08:56 CDT 2004

About this function that you use to add a new primary key value:
1. Is it a stored procedure in the VFP database that your table belongs to?
2. Is this procedure set as the DEFAULT value for this column in the table?

-Anders

"marcbelgium" <marcbelgium@discussions.microsoft.com> wrote in message
news:DAF06D2C-75AE-4CE2-B18B-5CD2002D3E1E@microsoft.com...
> Hello all
> excuse for my bad english
>
> I have database in foxpro
> tables with unique keys
>
> when i add a record in foxpro i use a fonction to add the new number
unique (the standart fonction in the foxpro exemple of database)
>
> but when i 'm under VB.net with oledb
> select , update and delete work fine.
>
> i try to make a oledbcommand with insert
> i insert all the other rows but not the row of the key row
>
> and the number of this key is always 0
> and thus the second insert makes an error because the key are not unique .
>
> Do you have a solution or must i read the number of the key in the other
table and add in VBNET
>
> Thanks and good day


Re: vb.net and foxpro 8 by Anders

Anders
Thu Jul 01 08:20:44 CDT 2004

A user in the French group found a solution to the same or a similar
problem. He changed the Default value from Newid() to Newid('aliasname'). By
the same token, make sure that the SEEK() and FLOCK() calls in the NEwid
procedure get the right alias assigned. SEEK("tablename"),
FLOCK('tablename') and so on.
-Anders

"marcbelgium" <marcbelgium@discussions.microsoft.com> wrote in message
news:7151C860-1B9F-4C80-9D8E-0102E3719FA1@microsoft.com...
> yes it is a stored procedure it is the same stored procedure as the
exemple database of foxpro newid() and the table with the key is setup
>
> yes it is the default value
>
> "Anders Altberg" wrote:
>
> > About this function that you use to add a new primary key value:
> > 1. Is it a stored procedure in the VFP database that your table belongs
to?
> > 2. Is this procedure set as the DEFAULT value for this column in the
table?
> >
> > -Anders
> >
> > "marcbelgium" <marcbelgium@discussions.microsoft.com> wrote in message
> > news:DAF06D2C-75AE-4CE2-B18B-5CD2002D3E1E@microsoft.com...
> > > Hello all
> > > excuse for my bad english
> > >
> > > I have database in foxpro
> > > tables with unique keys
> > >
> > > when i add a record in foxpro i use a fonction to add the new number
> > unique (the standart fonction in the foxpro exemple of database)
> > >
> > > but when i 'm under VB.net with oledb
> > > select , update and delete work fine.
> > >
> > > i try to make a oledbcommand with insert
> > > i insert all the other rows but not the row of the key row
> > >
> > > and the number of this key is always 0
> > > and thus the second insert makes an error because the key are not
unique .
> > >
> > > Do you have a solution or must i read the number of the key in the
other
> > table and add in VBNET
> > >
> > > Thanks and good day
> >
> >