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.