Home All Groups Group Topic Archive Search About

Table Adapter Update Method

Author
18 Oct 2006 3:29 PM
Mohamed Shafiee
Hi,

I'm trying to build a database application in Visual Studio 2005. The
language which I'm using is vb.net . I created a new Windows Application,
added a database, created a table, and then used the Configure Dataset
wizard to create a tableset with the new table Table 1. I dragged the
tableset into the form, and Visual Studio 2005 miraculously created a very
nice form for the table. But the problem is, the Save button in the Binding
Navigator control doesn't work. It doesn't give an error, but when I close
the form and open the table to view its data, I can't find the newly entered
data. Any idea how I can make it work?

Shafiee.

Author
18 Oct 2006 4:23 PM
Kerry Moorman
Shafiee,

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

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

Kerry Moorman


Show quoteHide quote
"Mohamed Shafiee" wrote:

> Hi,
>
> I'm trying to build a database application in Visual Studio 2005. The
> language which I'm using is vb.net . I created a new Windows Application,
> added a database, created a table, and then used the Configure Dataset
> wizard to create a tableset with the new table Table 1. I dragged the
> tableset into the form, and Visual Studio 2005 miraculously created a very
> nice form for the table. But the problem is, the Save button in the Binding
> Navigator control doesn't work. It doesn't give an error, but when I close
> the form and open the table to view its data, I can't find the newly entered
> data. Any idea how I can make it work?
>
> Shafiee.
>
>
>
Author
18 Oct 2006 4:26 PM
Cor Ligthert [MVP]
Mohamed,

I assume that you did it this way, but some things are in my idea different?

http://www.vb-tips.com/dbpages.aspx?ID=1139f14a-c236-4ad7-8882-b1ed16424252

I hope this helps,

Cor

Show quoteHide quote
"Mohamed Shafiee" <shafee_moha***@hotmail.com> schreef in bericht
news:OQ2jtps8GHA.4552@TK2MSFTNGP05.phx.gbl...
> Hi,
>
> I'm trying to build a database application in Visual Studio 2005. The
> language which I'm using is vb.net . I created a new Windows Application,
> added a database, created a table, and then used the Configure Dataset
> wizard to create a tableset with the new table Table 1. I dragged the
> tableset into the form, and Visual Studio 2005 miraculously created a very
> nice form for the table. But the problem is, the Save button in the
> Binding Navigator control doesn't work. It doesn't give an error, but when
> I close the form and open the table to view its data, I can't find the
> newly entered data. Any idea how I can make it work?
>
> Shafiee.
>
Author
19 Oct 2006 4:20 AM
Shafiee
Thanks for the post Mr. Cor.

Last night I figured that it is because I didn't set the DeleteCommand,
UpdateCommand, and InsertCommand properties of the tableset object. Is that
the reason? Those are set to none by default. Do you know how to set those
properties?

Thanks in advance...





Show quoteHide quote
"Cor Ligthert [MVP]" wrote:

> Mohamed,
>
> I assume that you did it this way, but some things are in my idea different?
>
> http://www.vb-tips.com/dbpages.aspx?ID=1139f14a-c236-4ad7-8882-b1ed16424252
>
> I hope this helps,
>
> Cor
>
> "Mohamed Shafiee" <shafee_moha***@hotmail.com> schreef in bericht
> news:OQ2jtps8GHA.4552@TK2MSFTNGP05.phx.gbl...
> > Hi,
> >
> > I'm trying to build a database application in Visual Studio 2005. The
> > language which I'm using is vb.net . I created a new Windows Application,
> > added a database, created a table, and then used the Configure Dataset
> > wizard to create a tableset with the new table Table 1. I dragged the
> > tableset into the form, and Visual Studio 2005 miraculously created a very
> > nice form for the table. But the problem is, the Save button in the
> > Binding Navigator control doesn't work. It doesn't give an error, but when
> > I close the form and open the table to view its data, I can't find the
> > newly entered data. Any idea how I can make it work?
> >
> > Shafiee.
> >
>
>
>
Author
19 Oct 2006 4:43 AM
Cor Ligthert [MVP]
Shafiee,

Mostly you can use the commandbuilder to start with (put it direct before
your update command) although it can in fact be everywere behind the select
or with a strongly typed dataset even before that.

http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlcommandbuilder.aspx

I hope this helps,

Cor



Show quoteHide quote
"Shafiee" <Shaf***@discussions.microsoft.com> schreef in bericht
news:F5855D57-08E0-460E-B1EF-2862DCC8A77E@microsoft.com...
> Thanks for the post Mr. Cor.
>
> Last night I figured that it is because I didn't set the DeleteCommand,
> UpdateCommand, and InsertCommand properties of the tableset object. Is
> that
> the reason? Those are set to none by default. Do you know how to set those
> properties?
>
> Thanks in advance...
>
>
>
>
>
> "Cor Ligthert [MVP]" wrote:
>
>> Mohamed,
>>
>> I assume that you did it this way, but some things are in my idea
>> different?
>>
>> http://www.vb-tips.com/dbpages.aspx?ID=1139f14a-c236-4ad7-8882-b1ed16424252
>>
>> I hope this helps,
>>
>> Cor
>>
>> "Mohamed Shafiee" <shafee_moha***@hotmail.com> schreef in bericht
>> news:OQ2jtps8GHA.4552@TK2MSFTNGP05.phx.gbl...
>> > Hi,
>> >
>> > I'm trying to build a database application in Visual Studio 2005. The
>> > language which I'm using is vb.net . I created a new Windows
>> > Application,
>> > added a database, created a table, and then used the Configure Dataset
>> > wizard to create a tableset with the new table Table 1. I dragged the
>> > tableset into the form, and Visual Studio 2005 miraculously created a
>> > very
>> > nice form for the table. But the problem is, the Save button in the
>> > Binding Navigator control doesn't work. It doesn't give an error, but
>> > when
>> > I close the form and open the table to view its data, I can't find the
>> > newly entered data. Any idea how I can make it work?
>> >
>> > Shafiee.
>> >
>>
>>
>>
Author
19 Oct 2006 6:26 AM
Branco Medeiros
Shafiee wrote:
> Last night I figured that it is because I didn't set the DeleteCommand,
> UpdateCommand, and InsertCommand properties of the tableset object. Is that
> the reason? Those are set to none by default. Do you know how to set those
> properties?

The designer will create the Delete, Update and Insert commands for you
if it can gather enough information from your table. Specifically (as
for my *little* experience), it will require at least a primary key in
your table.

Because it seems you're just experimenting with the technology, I'd
suggest you delete the dataset created by the wizard, go back to your
table, add a primary key to it and try the wizard again.

Notice, also, that the Delete/Update/Insert methods won't be created if
the GenerateDBDirectMethods property of the table's TableAdapter is set
to false. If this is the case, set it to true (in the dataset designer,
click the title of the table's TableAdapter window to see the adapter's
properties) and save the dataset, so the designer will create the
methods automagically.

HTH.

Regards,

Branco.
Author
19 Oct 2006 7:00 AM
Shafiee
Thank you... I will try that. :)

Show quoteHide quote
"Branco Medeiros" wrote:

> Shafiee wrote:
> > Last night I figured that it is because I didn't set the DeleteCommand,
> > UpdateCommand, and InsertCommand properties of the tableset object. Is that
> > the reason? Those are set to none by default. Do you know how to set those
> > properties?
>
> The designer will create the Delete, Update and Insert commands for you
> if it can gather enough information from your table. Specifically (as
> for my *little* experience), it will require at least a primary key in
> your table.
>
> Because it seems you're just experimenting with the technology, I'd
> suggest you delete the dataset created by the wizard, go back to your
> table, add a primary key to it and try the wizard again.
>
> Notice, also, that the Delete/Update/Insert methods won't be created if
> the GenerateDBDirectMethods property of the table's TableAdapter is set
> to false. If this is the case, set it to true (in the dataset designer,
> click the title of the table's TableAdapter window to see the adapter's
> properties) and save the dataset, so the designer will create the
> methods automagically.
>
> HTH.
>
> Regards,
>
> Branco.
>
>