PC Review


Reply
Thread Tools Rate Thread

Databings & Insert New Record

 
 
=?Utf-8?B?U3VwYSBIb29wc2E=?=
Guest
Posts: n/a
 
      12th Aug 2004
Using a Windows Application Form I have about 20-30 fields displayed on a
Form that are bound to a dataset.

Rather than create a large SQL command/Stored Procedure to insert each of
these fields, can I not use the CommandBuilder and the Databinding?

I cannot work out how to force the dataset's DataRowState to "Added"

Am I missing something really simple or is this something that cannot be done?

Any help greatly appreciated.
 
Reply With Quote
 
 
 
 
Cor Ligthert
Guest
Posts: n/a
 
      12th Aug 2004
Supa,

> Am I missing something really simple or is this something that cannot be

done?

When I understand your message well, probably yes.

BindingContext(ds.Tables(0)).EndCurrentEdit()

I hope this helps?

Cor


 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      12th Aug 2004
Supa,

Did you try what I showed in your showbutton procedure?


Cor


 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      12th Aug 2004
savebutton
>
> Did you try what I showed in your showbutton procedure?
>



 
Reply With Quote
 
=?Utf-8?B?U3VwYSBIb29wc2E=?=
Guest
Posts: n/a
 
      13th Aug 2004
Yes I tried that, but the dataset.haschanges(DataRowState) still = modified.

How do I get it to ADD/INSERT a new record?

"Cor Ligthert" wrote:

> savebutton
> >
> > Did you try what I showed in your showbutton procedure?
> >

>
>
>

 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      13th Aug 2004
Hi Suspa,

The dataset haschanges is for all tables and all rows in a dataset. I wished
there was a datatable.haschanges because now you are forced to use seperated
datasets when you want to update some tables in advance.

When you want individual rows checked, you have to check those using the
row, what is possible as well.

http://msdn.microsoft.com/library/de...statetopic.asp

I hope this helps?

Cor

> Yes I tried that, but the dataset.haschanges(DataRowState) still =

modified.
>
> How do I get it to ADD/INSERT a new record?
>
> "Cor Ligthert" wrote:
>
> > savebutton
> > >
> > > Did you try what I showed in your showbutton procedure?
> > >

> >
> >
> >



 
Reply With Quote
 
=?Utf-8?B?TWFzaA==?=
Guest
Posts: n/a
 
      1st Oct 2004
Do you have an answer to this issue yet?

I have the same problem. I add a row to a DataTable (at which point the
RowState is "Added"), but I let the user change values before I insert to the
DB. The RowState has changed to "Modified" so my insert doesn't happen.

Tried creating a new DataTable to use for inserts and using the Copy() and
ImportRow() methods but they all take the "Modified" row state with them.

"Supa Hoopsa" wrote:

> Using a Windows Application Form I have about 20-30 fields displayed on a
> Form that are bound to a dataset.
>
> Rather than create a large SQL command/Stored Procedure to insert each of
> these fields, can I not use the CommandBuilder and the Databinding?
>
> I cannot work out how to force the dataset's DataRowState to "Added"
>
> Am I missing something really simple or is this something that cannot be done?
>
> Any help greatly appreciated.

 
Reply With Quote
 
Neil Allen
Guest
Posts: n/a
 
      1st Oct 2004
On Thu, 30 Sep 2004 20:19:01 -0700, "Mash"
<(E-Mail Removed)> wrote:

>Do you have an answer to this issue yet?
>
>I have the same problem. I add a row to a DataTable (at which point the
>RowState is "Added"), but I let the user change values before I insert to the
>DB. The RowState has changed to "Modified" so my insert doesn't happen.
>
>Tried creating a new DataTable to use for inserts and using the Copy() and
>ImportRow() methods but they all take the "Modified" row state with them.
>
>"Supa Hoopsa" wrote:
>
>> Using a Windows Application Form I have about 20-30 fields displayed on a
>> Form that are bound to a dataset.
>>
>> Rather than create a large SQL command/Stored Procedure to insert each of
>> these fields, can I not use the CommandBuilder and the Databinding?
>>
>> I cannot work out how to force the dataset's DataRowState to "Added"
>>
>> Am I missing something really simple or is this something that cannot be done?
>>
>> Any help greatly appreciated.


Dear Mash,

In our limited experience we've found that the RowState value of a
newly added row is "Added" until "AcceptChanges()" is called - even
if the user changes the data in the newly added row.

Are you sure you haven't called "AcceptChanges()" somewhere in your
program?

I'm interested in the problem, so if you can post the fewest possible
lines of code to illustrate the problem then I'd be happy to have a
closer look.


Regards

Neil Allen

 
Reply With Quote
 
=?Utf-8?B?TWFzaA==?=
Guest
Posts: n/a
 
      1st Oct 2004
Hi Neil,

Yep - you got me. On the 23rd look through the code there was indeed an
AcceptChanges() call out there screwing me up. Working great now of course!

Thanks for replying...

"Neil Allen" wrote:

> On Thu, 30 Sep 2004 20:19:01 -0700, "Mash"
> <(E-Mail Removed)> wrote:
>
> >Do you have an answer to this issue yet?
> >
> >I have the same problem. I add a row to a DataTable (at which point the
> >RowState is "Added"), but I let the user change values before I insert to the
> >DB. The RowState has changed to "Modified" so my insert doesn't happen.
> >
> >Tried creating a new DataTable to use for inserts and using the Copy() and
> >ImportRow() methods but they all take the "Modified" row state with them.
> >
> >"Supa Hoopsa" wrote:
> >
> >> Using a Windows Application Form I have about 20-30 fields displayed on a
> >> Form that are bound to a dataset.
> >>
> >> Rather than create a large SQL command/Stored Procedure to insert each of
> >> these fields, can I not use the CommandBuilder and the Databinding?
> >>
> >> I cannot work out how to force the dataset's DataRowState to "Added"
> >>
> >> Am I missing something really simple or is this something that cannot be done?
> >>
> >> Any help greatly appreciated.

>
> Dear Mash,
>
> In our limited experience we've found that the RowState value of a
> newly added row is "Added" until "AcceptChanges()" is called - even
> if the user changes the data in the newly added row.
>
> Are you sure you haven't called "AcceptChanges()" somewhere in your
> program?
>
> I'm interested in the problem, so if you can post the fewest possible
> lines of code to illustrate the problem then I'd be happy to have a
> closer look.
>
>
> Regards
>
> Neil Allen
>
>

 
Reply With Quote
 
Neil Allen
Guest
Posts: n/a
 
      3rd Oct 2004
On Fri, 1 Oct 2004 15:17:08 -0700, "Mash"
<(E-Mail Removed)> wrote:

>Hi Neil,
>
>Yep - you got me. On the 23rd look through the code there was indeed an
>AcceptChanges() call out there screwing me up. Working great now of course!
>
>Thanks for replying...
>
>"Neil Allen" wrote:
>
>> On Thu, 30 Sep 2004 20:19:01 -0700, "Mash"
>> <(E-Mail Removed)> wrote:
>>
>> >Do you have an answer to this issue yet?
>> >
>> >I have the same problem. I add a row to a DataTable (at which point the
>> >RowState is "Added"), but I let the user change values before I insert to the
>> >DB. The RowState has changed to "Modified" so my insert doesn't happen.
>> >
>> >Tried creating a new DataTable to use for inserts and using the Copy() and
>> >ImportRow() methods but they all take the "Modified" row state with them.
>> >


<snip>

Dear Mash

Jolly good!

Regards

Neil Allen



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I insert a photo in a database record for that record only Chris Microsoft Access Getting Started 3 30th Dec 2007 08:17 PM
TableAdapter.Insert get newly insert record =?Utf-8?B?Z21jY2FsbHVt?= Microsoft C# .NET 1 13th Sep 2006 02:00 AM
Opinions wanted: Bulk Insert vs Record Insert =?Utf-8?B?RGFsZSBGeWU=?= Microsoft Access Form Coding 2 8th Mar 2006 03:26 PM
Update if record found otherwise insert new record Joey Microsoft Access Queries 3 28th Mar 2005 08:35 PM
Insert record in one table and it inserts a record in another =?Utf-8?B?bXdkbWFuamc=?= Microsoft Access Getting Started 1 5th Jan 2005 08:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:08 PM.