Hello,
I am trying to do a simple update on employee information. I am a
novice at both aspx and SQLServer, so I hope you are not too offended
by my code. The following is the update code:
--Start of code--
dim objConnection as SqlConnection
dim daAddEmp as SqlDataAdapter
dim strconnection as string = "myserverlocation"
objconnection = New SqlConnection(strConnection)
dim strSQL as String = "SELECT * FROM employees"
dim daEditEmp as New SqlDataAdapter(strSQL, objConnection)
dim dsTemp as New Dataset()
daEditEmp.Fill(dsTemp, "editemployee")
dim tbl as DataTable = dsTemp.Tables("editemployee")
tbl.PrimaryKey = New DataColumn() _
{ tbl.Columns("emp_id") }
dim row as DataRow = tbl.Rows.Find(session("empid"))
Row.Item("Emp_Num") = EmpNum.text
Row.Item("Emp_Last") = empLast.text
Row.Item("Emp_First") = empFirst.text
Row.Item("Emp_Title") = empTitle.text
Row.Item("Emp_Dept") = empDept.text
Row.Item("Emp_Site") = empSite.selecteditem.value
Row.Item("Emp_Add") = empAdd.text
Row.Item("Emp_Work") = empWork.text
Row.Item("Emp_Fax") = empFax.text
Row.Item("Emp_Home") = empHome.text
Row.Item("Emp_Email") = empEmail.text
Row.Item("Emp_Mgr") = empMgr.text
Row.Item("Emp_Mgr_Phone") = empMgrnum.text
Row.Item("Emp_Pass") = emppass.text
dim cb as New SqlCommandBuilder(daEditEmp)
objConnection.Open()
daEditEmp.Update(dsTemp, "editemployee")
objconnection.close()
fill_page() 'calls procedure to repopulate fields
--end of code--
I appreciate any and all help. Thanks.
--Ron