473,473 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Q: Dataview and a grid

Hi

Can anybody help with the following?

I have a datagrid which has a dataview of a datatable in a dataset as a
view. I can add new rows to the grid, however I'm puzzled as to how to pass
these changes to the database i.e. if I simple use Update on the table, the
rows I've added to the grid aren't written to the database.

Can anybody help?

Thanks in advance

Geoff
Feb 21 '06 #1
4 1217
Geoff,

Mostly is the point that there is only an endcurrentedit needed direct
before your update statement.
BindingContext("dv").EndCurrentEdit()

Something like that where the dv stends for your datasource

I hope this helps

Cor
"G .Net" <no********@email.com> schreef in bericht
news:Ad******************************@pipex.net...
Hi

Can anybody help with the following?

I have a datagrid which has a dataview of a datatable in a dataset as a
view. I can add new rows to the grid, however I'm puzzled as to how to
pass these changes to the database i.e. if I simple use Update on the
table, the rows I've added to the grid aren't written to the database.

Can anybody help?

Thanks in advance

Geoff

Feb 21 '06 #2
Hi Cor

Thanks for your suggestion. I think I may have found a solution to my
problem by an alternative method. However, I hope you may be able to help
with a related matter.

The DataView I'm using as the datasource to the grid has a filter. The
condition for the filter is not one of the fields being displayed. So, for
example, if the grid displays two columns A and B, the value in column C
(which is not displayed) is the filter condition.

The problem I have is that I add data to the grid and obviously because the
value in C is not being inputted in the grid, the row immediately disappears
after inputting data. How can I write a value into C as soon as the user
starts adding data to the row in the grid so it doesn't disappear i.e. the
filter condition will be satisfied.

Thanks in advance

Geoff

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:Ox**************@TK2MSFTNGP10.phx.gbl...
Geoff,

Mostly is the point that there is only an endcurrentedit needed direct
before your update statement.
BindingContext("dv").EndCurrentEdit()

Something like that where the dv stends for your datasource

I hope this helps

Cor
"G .Net" <no********@email.com> schreef in bericht
news:Ad******************************@pipex.net...
Hi

Can anybody help with the following?

I have a datagrid which has a dataview of a datatable in a dataset as a
view. I can add new rows to the grid, however I'm puzzled as to how to
pass these changes to the database i.e. if I simple use Update on the
table, the rows I've added to the grid aren't written to the database.

Can anybody help?

Thanks in advance

Geoff


Feb 21 '06 #3
Georg,

Better is not to extend questions with new questions, maybe is there
somebody who knows the answer direct. Because of what you ask, I use a
button to add on a screen.

I thought that there was a solution, so maybe it is better to make a new
message.

Cor
Feb 22 '06 #4
If AllowNew is true you can use the AddNew method of the DataView to create a new DataRowView. Note that a new row is not actually added to the underlying DataTable until the EndEdit method of the DataRowView is called. If the CancelEdit method of the DataRowView is called, the new row is discarded.

Dim custTable As DataTable = custDS.Tables("TBL1")
Dim custView As DataView = custTable.DefaultView

custView.AllowDelete = False

Dim newDRV As DataRowView = custView.AddNew()
newDRV("Field1") = "ABCDE"
newDRV("Field2") = "ABCDE Descr"
newDRV.EndEdit()
As an alternative download IdeaBlade’s DevForce Express and use that for ORM (I don’t work for them – but use it extensively)

Apr 1 '06 #5

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

Similar topics

9
by: jwedel_stolo | last post by:
Hi I'm creating a dataview "on the fly" in order to sort some data prior to writing out the information to a MS SQL table I have used two methods in order to determine the sort order of the...
4
by: Martin Schmid | last post by:
I am trying to implement a DataView for a DataGrid so I can sort at runtime by clicking on column headers. My initial page load works... it displays the data However, when I click a column...
2
by: Hananiel | last post by:
Using Dataview as a datasource for datagrid works fine while viewing. When I make a new row, by calling dataview.AddNew(), it removes all the rows in the grid. Anyone know whats going on? In any...
0
by: VM | last post by:
In my Windows application, I load an ascii file into a tableX and set the datagrid.DataSource = tableX. The problem begins when I try to retrieve the data from the grid in order to process the...
13
by: Steve | last post by:
I have a form with a dataset and a datagrid. I created a dataview on this dataset. When the user modifies the datagrid, I look up this record in the dataview to make sure it is unique. Here is...
4
by: Aaron Smith | last post by:
Dim dv As DataView = New DataView(FacilitiesDS1.Facilities, "", "ID ASC", DataViewRowState.CurrentRows) Dim iPos As Integer = dv.Find(dr.Item("ID")) Me.BindingContext(FacilitiesDS1,...
2
by: HansP | last post by:
Hi, I am really in a deadlock with this problem. In my VS2005 C# handheld application, I have a grid with Workorders. Another grid (child) are the ACTIONS, performed for each workorder. ...
3
by: G .Net | last post by:
Hi I'm hoping that somebody can help me with the following: I have a DataTable which I'm displaying in a DataGrid. I am changing values in this grid which need to be passed back to the...
7
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, I'm using vs2005, .net 2 for windows applciation. I have a form with 1 datagrids whose datasource comes from 2 dataview that are based on 2 dataset datatables(depends on the stat of the...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.