Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

edit

Status
Not open for further replies.

adamdavies

Programmer
May 21, 2003
20
AU
trying to use update on datagrid
i get an error on FNameTextBox = E.Item.Cells(3).Controls(0)


Dim editkey As String
Dim FNameTextBox As TextBox
Dim SNameTextBox As TextBox

editkey = dgusers.DataKeys(E.Item.ItemIndex)
FNameTextBox = E.Item.Cells(3).Controls(0)
SNameTextBox = E.Item.Cells(4).Controls(0)

Dim strSQL As String = "Update QuickQuery Set FName='" & FNameTextBox.Text & "', SName = '" & SNameTextBox.Text & "' WHERE EmpCDate= '" & editkey & "'"

Dim objConn As New OleDbConnection(strConn)
Dim objCmd As New OleDbCommand(strSQL, objConn)

objConn.Open()
objCmd.ExecuteNonQuery()
objConn.Close()

dgusers.BackColor = System.Drawing.Color.White
dgusers.EditItemIndex = -1
DataBind()


does anybody know where i am going wrong, can supply more info

thanks
adam
 
What error message do you get?
Anyway, try
FNameTextBox = ctype(E.Item.Cells(3).Controls(0), textbox)


Mark [openup]
 
mark,

ive now got it working

cheers for the help
ads
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top