473,545 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A Strange Issue with DataGrid

Hello,

I am trying to bind a DataTable to a Grid which will allow users to
Edit data and then submit the changes back to the Database. I want to
display values in the Grid satisfying a particular criteria like
follows:

Dim tbl as new DataTable
For Each row As DataRow In DataTableName.R ows
If (row.Item("Colu mnName") Is System.DBNull.V alue) Then
tbl.Rows.Add(ro w.ItemArray)
End If
Next

Grid.DataSource = tbl

But on the other hand I have created and Filled the DataTableName
dataTable as follows:

DataAdapter.Fil l(DataTableName )

After the user has done changes on the Grid (e.g. Deleted few rows,
modifies few column values or added few rows), I want to Update the
Table and I issue the following command for that:

DataAdapter.Upd ate(tbl)

Which gives me a problem that the Rows are not properly updated rather
multiple records are added for nothing and many other problems are
seen in the original table.

Also I cannot Update using the following:

DataAdapter.Upd ate(DataTableNa me)

because I didn't bind the DataTableName DataTable to the Grid because
I only want to display records in the Grid satisfying certain
criteria.

Has anyone any idea how to make it work or modify my logic.

cheers
Nov 20 '05 #1
1 1018
Cor
Hi Sajid,

Your have in my opinion defintily have to look first to the dataview (very
easy to handle in combination with a datagrid) and the SQL or OleDb
commandbuilder.

Know also that deleting rows from the datagrid using the "del" key on the
keyboard will delete the row but also the information that it is deleted and
therefore never update the database.

Do also not forget to do before the update the currencymanager
endcurrentedit methode

I hope this helps for a start?

Cor
Nov 20 '05 #2

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

Similar topics

0
1511
by: elime | last post by:
Hi all I have a strange behaving on some PC with my DataGrid. It only occurs on some PC, on others it works perfectly fine. ->(same ..net version installed) it's very confusing. starting position: I click with the mouse into a cell of the DataGrid, the cell gets active (gray) and marks the cell-content.
2
1974
by: michele | last post by:
Hi, i'm using a datagrid control in my webform, with AutoGenerateColumns=false; it work very well if EnableViewState=true; including paging and sorting, but this cause a big performance issue, so i've decided to set EnableViewState=false: now the events related to the datagrid have some strange behavours: for example the PageIndexChangedEvent...
1
1338
by: Kepler | last post by:
I'm fighting a really strange bug that involves both a DataGrid and a Repeater disappearing on postback. The strange thing is that I've distilled the problem down to a simple program, that originally could reproduce the problem, but now can't, even as I add complexity back in. The basic scenario is a custom DataGrid (just make a class that...
2
1069
by: sosh | last post by:
Hi, I'm having a strange problem with the update function of a datagrid: I have a datagrid, the first column lists item names from a database. Second column is an EditCommandColumn, and then I have a couple of button columns after that to deal with row deletes etc. The problem is occuring in the method that I have specified should deal...
4
2533
by: jibran | last post by:
Hello. I have wrapped the DataGrid control with my own class (SmartDataGrid) adding some necessary functionality. My current webform has 2 SmartDataGrids. The first is populated by selected information from a drop down box. The second datagrid is populated by viewing details from a row of the first datagrid. When editing individual rows...
1
220
by: Sajid | last post by:
Hello, I am trying to bind a DataTable to a Grid which will allow users to Edit data and then submit the changes back to the Database. I want to display values in the Grid satisfying a particular criteria like follows: Dim tbl as new DataTable For Each row As DataRow In DataTableName.Rows If (row.Item("ColumnName") Is...
1
1123
by: Chris | last post by:
Hey, I have a DataGrid that allows for a combobox in a column through a inherited DataGridColumnStyle and a inherited ComboBox. I have 3 of these columns in a row. The overall problem is that when I hit TAB on the first of 3 of these columns the cursor moves into the second and then immideantly leaves and moves to the third box. if you...
1
2374
by: Lurc | last post by:
Hi all, One field of Access table is date/time type, and format is long time. In VB.NET, as this table linked to a datagrid, a strange date 12-30-1899 is shown instead of the time expected. What should I do to let it show time only? Thanks.
2
287
by: Antonio | last post by:
Good morning, everyone. Here is the strange behavior: I have a datagrid (dgPIs) with paging enabled. When I click to view any page in the grid, it runs the private void lnkIPReg method, instead of the private void IPchangePage. The lnkIPReg method refers to a linkbutton that I created in the grid. The datagrid properties list the...
1
1763
by: chris3vic | last post by:
I have a dynamically created datagrid, populated from a dataset that is filled by a sql string triggered by a command button. The application itself allows a user to input a selection of criteria and hit search, the results ome back in the grid. Due to the probably amount of records that will be returd, I decided to allow paging to make the...
0
7465
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7398
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7656
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7805
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
5969
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5325
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4944
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1878
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1013
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.