473,388 Members | 1,330 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Databings & Insert New Record

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.
Jul 21 '05 #1
9 1758
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
Jul 21 '05 #2
Supa,

Did you try what I showed in your showbutton procedure?
Cor
Jul 21 '05 #3
savebutton

Did you try what I showed in your showbutton procedure?

Jul 21 '05 #4
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?


Jul 21 '05 #5
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?


Jul 21 '05 #6
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.

Jul 21 '05 #7
On Thu, 30 Sep 2004 20:19:01 -0700, "Mash"
<Ma**@discussions.microsoft.com> 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

Jul 21 '05 #8
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"
<Ma**@discussions.microsoft.com> 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

Jul 21 '05 #9
On Fri, 1 Oct 2004 15:17:08 -0700, "Mash"
<Ma**@discussions.microsoft.com> 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"
<Ma**@discussions.microsoft.com> 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

Jul 21 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Tony Clarke | last post by:
Hi, I'm trying to write a system thats used for about 50 clients that uses html forms and php to log details. The problem is that when a client loads the form page it's given a value which is...
4
by: Max | last post by:
Hello everyone, and thank you in advance for all of your help! I have a tblPrint table in Access 2002. Its structure is as follows: tblPrint ------------------ Name, Text Address1, Text...
15
by: Bart | last post by:
Hi, I receive an utf8 character from a database, like 田 (Japanese Character, style: &#XXXXX). How can I visualize the Japanese character on my application? I have found the class...
9
by: Supa Hoopsa | last post by:
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...
1
by: dirk van waes | last post by:
Hello everyone, Being complete newbie in asp.net I am trying to make an example which works with a very simple database. First I made my project in VS- vb.net, draging an oledbconnection and an...
1
by: JNariss | last post by:
Hello, I have created a connection to my Access database with Dreamweaver and made a simple form with 4 fields. The code behind this form was/is: <%@LANGUAGE="VBCRIPT" CODEPAGE="1252"%>...
0
by: jeffmagill | last post by:
Hi Everybody, I'm really hoping that someone can help me out because I have spent too much time on this project already! Basically, I have a DetailsView that handles all the Edits for a...
2
by: Mike | last post by:
Greetings, It would seem that this topic has been discussed at some length, but I was unable to discern whether there was a clear cut solution to resolve and/or otherwise workaround the issue. ...
1
by: Kyle K. | last post by:
I would like to build my data pages such that the top of the page contains a GridView showing the data with 'Enable Select = true'. Below that I would like to have a FormView, that by default is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.