473,397 Members | 1,974 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,397 software developers and data experts.

How to save data from a Datagrid to Database

In a web form, I use a datagrid to view, modify data of a table.
My datagrid has 14 columns:
Column 1: ID (key field)
Column 2 and 3: Button (Edit and Delete)
Column 4 to end: the remain fields

In the event procedure DataGrid_UpdateCommand, I make a sql string like that:

st = "UPDATE timer.tblBrands SET " & _
"BrandCode = N'" & e.Item.Cells(3).Text.Trim & "', " & _
"BrandName = N'" & e.Item.Cells(4).Text.Trim & "', " & _
"Tel = N'" & e.Item.Cells(5).Text.Trim & "', " & _
"Fax = N'" & e.Item.Cells(6).Text.Trim & "', " & _
"Email = N'" & e.Item.Cells(7).Text.Trim & "', " & _
"Manager = N'" & e.Item.Cells(8).Text.Trim & "', " & _
"ManagerTel = N'" & e.Item.Cells(9).Text.Trim & "', " & _
"ManagerEmail = N'" & e.Item.Cells(10).Text.Trim & "', " & _
"Accounter = N'" & e.Item.Cells(11).Text.Trim & "', " & _
"AccounterTel = N'" & e.Item.Cells(12).Text.Trim & "', " & _
"AccounterEmail = N'" & e.Item.Cells(13).Text.Trim & _
" WHERE ID =" & e.Item.Cells(0).Text


e.Item.Cells(0).Text return a correct value, but other e.Item.Cells(x).Text return empty value!

I don't know why. Please tell me how to correct this.

Thanks.
Jan 5 '07 #1
0 3629

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Angie | last post by:
datagrid ex. a 1 checkbox b 2 checkbox c 3 checkbox once a user selects these 3 rows from a datagrid and i want to save the 1, 2, 3 value into the database how do i do this? I know...
4
by: HomeyDaClown | last post by:
I'm new to the VB.net world and have been reading alot of books and threw newsgroups Is it even posable to save user input from a form to a data grid. I could just edit the data gri but would...
0
by: Hugo Lefevre | last post by:
Dear, I have on a form a datagrid (datagrid1) which is filled by a dataset created in the class Afwezigheid. A button "Alles" show the whole table in the datagrid and when someone wants to...
2
by: Alpha | last post by:
Hi, I have a window based program. One of the form has several textboxes and a datagrid. The textboxes are bind to the same dataset table as the datagrid and the text changes to reflect different...
5
by: tshad | last post by:
Is there a way to carry data that I have already read from the datagrid from page to page? I am looking at my Datagrid that I page through and when the user says get the next page, I have to go...
0
by: Patty05 | last post by:
I have a datagrid on a form that update properly when form loads. When the program runs and I type in/add a new row in the datagrid, it does not save the changes. Any help would be greatly...
4
by: nch1978 | last post by:
I am new to programming and am sorry if this post is in the wrong area. I have a listbox bound to a table and a datagrid bound to another one with a connection through xml. I can change the data...
2
by: toddw607 | last post by:
Hi all! I am attempting to bring an SQL Server table into ASP.NET using the datagrid . I have set all cells to be a text box by which the user can just click on and edit the cell. I have a...
11
by: gyap88 | last post by:
Hello i m using vb 2005 express to do my project. I m suppose to create a datagrid to allow user to make changes to the database. The program display the database in a datagrid where users can juz...
1
by: jagjitsurfer | last post by:
hi, I am using datagrid view in my solution which displays data from a table of database. I allows users to directly update, insert or delete data from data grid view, but i can't save the data...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
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...
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,...

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.