Results 1 to 2 of 2

Thread: Desperately!!!

  1. #1
    Join Date
    Dec 1969

    Default Desperately!!!

    Hey guys,<BR>I need help...<BR>i am creating a web page which can display employee details and modify it.I have no problems displaying data in the grid as well as adding data into the database.<BR>I wanted to modify data from the database,so what i did was create an edit button in the display employee details grid which when clicked would open up a new page which would display all the relevant data in text boxes and other elements.Now heres where the problem occurs when i click on the update button nothing happens...<BR>this is the code that i wrote to display data from grid into text boxes<BR><BR>sub edit_det()<BR> txtEmployeeID.Text = Request.Params("empid")<BR> Dim str As String = "Select * from employees where employeeID= &#039;" & txtEmployeeID.Text & "&#039;"<BR> Dim con As New SqlConnection(constr)<BR> Dim cmd As New SqlCommand(str, con)<BR> Dim da As New SqlDataAdapter(cmd)<BR> Dim ds As New DataSet()<BR> da.Fill(ds, "employees")<BR> txtFirstName.Text = ds.Tables("employees").Rows(0)("FirstName")<BR> txtlastname.Text = ds.Tables("employees").Rows(0)("Lastname")<BR> txtTitleOfCourtesy.Text = ds.Tables("employees").Rows(0)("TitleOfCourtesy")< BR> txtBirthDate.Text = ds.Tables("employees").Rows(0)("BirthDate")<BR> txthiredate.Text = ds.Tables("employees").Rows(0)("hiredate")<BR> txtCity.Text = ds.Tables("employees").Rows(0)("City")<BR> txtPostalCode.Text = ds.Tables("employees").Rows(0)("PostalCode")<BR> txtCountry.Text = ds.Tables("employees").Rows(0)("Country")<BR> txtHomePhone.Text = ds.Tables("employees").Rows(0)("HomePhone")<BR> txttitle.Text = ds.Tables("employees").Rows(0)("Title")<BR> txtAddress.Text = ds.Tables("employees").Rows(0)("Address")<BR> con.Close()<BR>the above code works perfectly alright<BR><BR><BR>and this is the code that I wrote on the click event of the update button...<BR>this part doesnt work...<BR> Dim con As New SqlConnection(constr)<BR> Dim str As String = "Select * from employees"<BR> Dim da As New SqlDataAdapter(str, con)<BR> Dim cmd As New SqlCommandBuilder(da)<BR> Dim ds As New DataSet()<BR> da.Fill(ds, "employees")ds.Tables("employees").Rows(0)("FirstN ame") = txtFirstName.Text<BR> ds.Tables("employees").Rows(0)("LastName") = txtlastname.Text<BR> .... <BR> ....<BR> ....<BR> da.Update(ds, "employees")<BR> Response.Redirect("employee.aspx"<BR>Please help me....<BR>any help would be appriciated...<BR>Frank<BR>

  2. #2
    Join Date
    Dec 1969

    Default no where do you

    update the database!<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts