Home All Groups Group Topic Archive Search About

Nothing inserted (oledb access 2000 - VB.NET 2005)

Author
18 Feb 2007 7:38 PM
Leo Leys
Hi,

I try to insert a record into an existing access table using VB.NET 2005.
When I use a tableadapter.insert method, the result is obviously 1 record
affected, but no actual record is added to the table.
I tried different ways (oledbcommand executenonquery..), the result remains
the same. The records affected property reports 1 record affeced as well, but
when I open acces directly, no rows are added at all.
I get no error message.
The table has an autonumber column (primary key).
What is going wrong?
Thanks in advance.
Leo

Author
18 Feb 2007 8:11 PM
Kerry Moorman
Leo,

Could it be that you are actually updating a copy of your database? See:

http://msdn2.microsoft.com/en-us/library/ms246989.aspx

Kerry Moorman


Show quote
"Leo Leys" wrote:

> Hi,
>
> I try to insert a record into an existing access table using VB.NET 2005.
> When I use a tableadapter.insert method, the result is obviously 1 record
> affected, but no actual record is added to the table.
> I tried different ways (oledbcommand executenonquery..), the result remains
> the same. The records affected property reports 1 record affeced as well, but
> when I open acces directly, no rows are added at all.
> I get no error message.
> The table has an autonumber column (primary key).
> What is going wrong?
> Thanks in advance.
> Leo
>
>
>
>
Author
19 Feb 2007 6:22 PM
Leo Leys
Thanks for your reply.

In the meantime I figured out what went wrong: The Copy to Output Directory
setting (of the mdb) was set to the default "Copy always" so after each run
the original (empty) database was copied over the copy in the \bin\debug
folder. I changed it to "Copy never" and now everything is working fine.

Kind regards,
Leo

Show quote
"Kerry Moorman" wrote:

> Leo,
>
> Could it be that you are actually updating a copy of your database? See:
>
> http://msdn2.microsoft.com/en-us/library/ms246989.aspx
>
> Kerry Moorman
>
>
> "Leo Leys" wrote:
>
> > Hi,
> >
> > I try to insert a record into an existing access table using VB.NET 2005.
> > When I use a tableadapter.insert method, the result is obviously 1 record
> > affected, but no actual record is added to the table.
> > I tried different ways (oledbcommand executenonquery..), the result remains
> > the same. The records affected property reports 1 record affeced as well, but
> > when I open acces directly, no rows are added at all.
> > I get no error message.
> > The table has an autonumber column (primary key).
> > What is going wrong?
> > Thanks in advance.
> > Leo
> >
> >
> >
> >

AddThis Social Bookmark Button