Results 1 to 6 of 6

Thread: update help

  1. #1

    Thread Starter
    Member Ooogaleee's Avatar
    Join Date
    Nov 2002
    Location
    Jacksonville, FL
    Posts
    52

    update help

    There's probably something obvious I'm missing here, but I can't get this code to update my Access table...


    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    Try
    If (rb1Y.Checked Or rb1N.Checked) Then
    Response.Redirect("orientationB.aspx")
    Else
    'advise of error
    l blError.Text = ">> There is at least one Yes/No question left unanswered. Please review. <<"
    Exit Sub
    End If
    'update answer table
    If rb1Y.Checked Then
    DsAnsOA1.Tables("tableOAAns").Rows(0).Item(1) = "yes"
    Else
    DsAnsOA1.Tables("tableOAAns").Rows(0).Item(1) = "no"
    End If
    DsAnsOA1.Tables("tableOAAns").Rows(0).Item(2) = tb2.Text
    DsAnsOA1.Tables("tableOAAns").Rows(0).Item(3) = tb3.Text
    DsAnsOA1.Tables("tableOAAns").Rows(0).Item(4) = tb4.Text
    daA.Update(DsAnsOA1)
    Catch ex As Exception
    Finally
    ' nothing here yet
    End Try
    End Sub


    can anyone give me a clue?...

    thanks much...Ooogs

  2. #2
    Hyperactive Member
    Join Date
    Dec 2001
    Location
    Dublin, Ireland
    Posts
    262
    Your code is never actually getting to the database part. It either redirects or exits the sub.

  3. #3

    Thread Starter
    Member Ooogaleee's Avatar
    Join Date
    Nov 2002
    Location
    Jacksonville, FL
    Posts
    52
    I revised it a bit...


    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    Try
    If (rb1Y.Checked Or rb1N.Checked) Then
    'update answer table
    If rb1Y.Checked Then
    DsAnsOA1.Tables("tableOAAns").Rows(0).Item(0) = "yes"
    ElseIf Not rb1Y.Checked Then
    DsAnsOA1.Tables("tableOAAns").Rows(0).Item(0) = "no"
    End If
    DsAnsOA1.Tables("tableOAAns").Rows(0).Item(1) = tb2.Text
    DsAnsOA1.Tables("tableOAAns").Rows(0).Item(2) = tb3.Text
    DsAnsOA1.Tables("tableOAAns").Rows(0).Item(3) = tb4.Text
    daA.Update(DsAnsOA1)
    Response.Redirect("orientationB.aspx")
    Else
    'advise of error
    lblError.Text = ">> There is at least one Yes/No question left unanswered. Please review. <<"
    Exit Sub
    End If
    Catch ex As Exception
    Finally
    End Try
    End Sub


    ...but it doesn't ever seem to get to the response.redirect command. It never leaves the page. Can anyone see what I'm missing?

    Thanks...Ooogs

  4. #4
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    On your catch block, put a break in with the IDE, then run your code. Figure out what the exception is.

  5. #5

    Thread Starter
    Member Ooogaleee's Avatar
    Join Date
    Nov 2002
    Location
    Jacksonville, FL
    Posts
    52
    No exception is being thrown. It's just not advancing to the redirected page.

  6. #6
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    How about stepping through each line in debug mode. Find out if you are even processing the Response.Redirect line. It looks right to me, as long as there is a page by the orientationB.aspx name in the same folder.

Posting Permissions

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



Click Here to Expand Forum to Full Width