473,794 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Edit a row

Hi,
I am a vb.net novice. I have a datatable which is populated with the
data from sql query.
dt = datastore.GetDa taTable(GetSql( uid, bin))
I want to edit each row in the datatable with new values but before
they are binded to the datagrid. what would be the best way to do it.
Any leads would be great
thanks
Jay

Sep 19 '06 #1
5 5700
Jay,

You could use a For Each loop to process each row.

For Each dr As DataRow in dt.Rows
'Process row dr
Next

Kerry Moorman
"ja**********@g mail.com" wrote:
Hi,
I am a vb.net novice. I have a datatable which is populated with the
data from sql query.
dt = datastore.GetDa taTable(GetSql( uid, bin))
I want to edit each row in the datatable with new values but before
they are binded to the datagrid. what would be the best way to do it.
Any leads would be great
thanks
Jay

Sep 19 '06 #2
Jay
I am updating the rows by getting values from another array. the array
is not sorted. I am not sure in which order the array will have
data.therefore i need to read the data from array and update the
corresponding row in the table.
any suggestions
thanks

Kerry Moorman wrote:
Jay,

You could use a For Each loop to process each row.

For Each dr As DataRow in dt.Rows
'Process row dr
Next

Kerry Moorman
"ja**********@g mail.com" wrote:
Hi,
I am a vb.net novice. I have a datatable which is populated with the
data from sql query.
dt = datastore.GetDa taTable(GetSql( uid, bin))
I want to edit each row in the datatable with new values but before
they are binded to the datagrid. what would be the best way to do it.
Any leads would be great
thanks
Jay
Sep 19 '06 #3
Jay,

You could sort both the datatable and the array on the same data element.

Or you could create a dataview from the datatable and use its Find method to
find the row that matches data from the array.

Kerry Moorman
"Jay" wrote:
I am updating the rows by getting values from another array. the array
is not sorted. I am not sure in which order the array will have
data.therefore i need to read the data from array and update the
corresponding row in the table.
any suggestions
thanks

Kerry Moorman wrote:
Jay,

You could use a For Each loop to process each row.

For Each dr As DataRow in dt.Rows
'Process row dr
Next

Kerry Moorman
"ja**********@g mail.com" wrote:
Hi,
I am a vb.net novice. I have a datatable which is populated with the
data from sql query.
dt = datastore.GetDa taTable(GetSql( uid, bin))
I want to edit each row in the datatable with new values but before
they are binded to the datagrid. what would be the best way to do it.
Any leads would be great
thanks
Jay
>
>

Sep 19 '06 #4
Kerry,

You are using a strongly typed datatable, that one is forever inherited from
a non strongly typed datatable

The main format of that is that it are two collection.
DataRows
DataColumns

DataRows have items which are described in the datacolumns.

You can forever get an item as
DataTable.DataR ows(TheRowIndex ).Item(TheDataC olumnName or the "DataItemna me"
or the Index)

This patern is of course as well in the strongly dataset. Most people don't
like to use the strongly typed datsets to do updating as you do, because
getting the right row is forever troublefull. Therefore cast it to a
standard datatable and use that.

I hope this gives an idea,

Cor

"Kerry Moorman" <Ke**********@d iscussions.micr osoft.comschree f in bericht
news:AF******** *************** ***********@mic rosoft.com...
Jay,

You could sort both the datatable and the array on the same data element.

Or you could create a dataview from the datatable and use its Find method
to
find the row that matches data from the array.

Kerry Moorman
"Jay" wrote:
>I am updating the rows by getting values from another array. the array
is not sorted. I am not sure in which order the array will have
data.therefo re i need to read the data from array and update the
correspondin g row in the table.
any suggestions
thanks

Kerry Moorman wrote:
Jay,

You could use a For Each loop to process each row.

For Each dr As DataRow in dt.Rows
'Process row dr
Next

Kerry Moorman
"ja**********@g mail.com" wrote:

Hi,
I am a vb.net novice. I have a datatable which is populated with the
data from sql query.
dt = datastore.GetDa taTable(GetSql( uid, bin))
I want to edit each row in the datatable with new values but before
they are binded to the datagrid. what would be the best way to do it.
Any leads would be great
thanks
Jay



Sep 20 '06 #5
Jay
thanks people i fixed the problem. I appreciate everyone's feedback
Jay
Cor Ligthert [MVP] wrote:
Kerry,

You are using a strongly typed datatable, that one is forever inherited from
a non strongly typed datatable

The main format of that is that it are two collection.
DataRows
DataColumns

DataRows have items which are described in the datacolumns.

You can forever get an item as
DataTable.DataR ows(TheRowIndex ).Item(TheDataC olumnName or the "DataItemna me"
or the Index)

This patern is of course as well in the strongly dataset. Most people don't
like to use the strongly typed datsets to do updating as you do, because
getting the right row is forever troublefull. Therefore cast it to a
standard datatable and use that.

I hope this gives an idea,

Cor

"Kerry Moorman" <Ke**********@d iscussions.micr osoft.comschree f in bericht
news:AF******** *************** ***********@mic rosoft.com...
Jay,

You could sort both the datatable and the array on the same data element.

Or you could create a dataview from the datatable and use its Find method
to
find the row that matches data from the array.

Kerry Moorman
"Jay" wrote:
I am updating the rows by getting values from another array. the array
is not sorted. I am not sure in which order the array will have
data.therefore i need to read the data from array and update the
corresponding row in the table.
any suggestions
thanks

Kerry Moorman wrote:
Jay,

You could use a For Each loop to process each row.

For Each dr As DataRow in dt.Rows
'Process row dr
Next

Kerry Moorman
"ja**********@g mail.com" wrote:

Hi,
I am a vb.net novice. I have a datatable which is populated with the
data from sql query.
dt = datastore.GetDa taTable(GetSql( uid, bin))
I want to edit each row in the datatable with new values but before
they are binded to the datagrid. what would be the best way to do it.
Any leads would be great
thanks
Jay
>
>

Sep 25 '06 #6

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

Similar topics

25
10426
by: dixie | last post by:
I have some code that adds new records into a table for each ID in a list box when a button on a form is clicked. This works fine. My problem now is that I wish to be able to edit all the records for people whose ID is in the list box. I made minor changes to the code (mainly replacing rs.AddNew with rs.Edit)and it appears to be updating only the first record and then overwriting that record with the next, etc until it runs out of ID's...
2
2339
by: Sky | last post by:
Hello: Another question about trying to wring functionality from a DataGrid... Have a DB table of "Contacts" -- 14 or more fields per record Show in datagrid -- but only 5 columns (First,Last, Fax, Phone, Category). Put an Edit column at the end... Now what?! If you go into Edit mode -- you can only edit 5 cells -- not all the rest of the Record's fields...not enough!
4
3719
by: Glenn M | last post by:
I have a shared XML file on a server . i also have one xslt file that performs a simple transform on in to view the data. now i want to have another page that lets users modify the shared xml file via some editable controls such as text boxes , option boxes etc. how can i implment this , should i use another xslt file with <INPUT> controls . if so how can i save the result back using the asp.net
3
1512
by: Schultz | last post by:
is there an easy to follow, source code in one document, article that explains how to create an edit all DataGrid control? and, I have a DataGrid setup where the client enters information for each row by clicking Edit-Update for each row. Each row has several columns, is there anyway to move the Edit function to edit each column individually for each row in the DataGrid?
8
1984
by: =?Utf-8?B?bWlrZWc=?= | last post by:
Hi, I am building a small Help Desk application for my company and need to be able to edit "open" help desk issues. I use a simple datagrid to display each issue (6 per page) , with an Edit button. There are a lot of fields across, and my Network Admins would like a way of editing/updating each issue seperately in a a vertical form. I need a way of clicking on the edit button ,bringing up a form with the record, editng the fields, and...
1
2168
by: ollielaroo | last post by:
Hi guys, Firstly I did do a search for this one first but I couldn't find anything related in this forum. I am using Dreamweaver MX and trying to build admin pages for an ASP site. My problem is I have Categories and various Products in each Category. I'm trying to build a page to EDIT/UPDATE each product.I want to be able to change the Category that a product belongs to, but all I get in the drop-down menu is the one specific Category. ...
1
1047
by: Anette | last post by:
I found the FAQ: I can't find any "edit" button by my post. The FAQ says "Your ability to edit your posts may also be time-limited, depending on how the administrator has set up the forum." I have posted threads in forum PHP and HTML/CSS. How are they set up? Should I be able to edit my post?
5
2159
by: Ryan Liu | last post by:
I have this problem: "cannot continue edit while debug in VS2005". I see the same tread after I search this topic in google, but none solutions works for me. So again, I ask here. Can someone give a hand? Has MS fixed this in VS 2005? Is is fixed in VS 2008? Thanks, ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
1
6753
by: rogerford | last post by:
I have a grid which i bind with values from Database. I have events to edit and update the grid. I am not using SqlDatasource to connect to DB. Rather i am doing the updating of the grid Programmatically. I have 3 columns, LID(item template column) ,LVal (Edit Item template column) and Edit link My Question: 1) My EditITemTemplate column has a textbox txt_Lval which does not show up on the page load. But if click on edit link that...
1
3330
by: chromis | last post by:
Hi, I'm having trouble fully implementing the edit section of a contact admin system, so far I have written the following: - Bean (Contact.cfc) - Data Access object (ContactDAO.cfc) - Gateway (ContactGateway.cfc) - index.cfm - Deals with the business logic - display/form.cfm - Produces the form for both add and edit behaviour
0
9672
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10435
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10163
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5436
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.