previous and next buttons

I want to read through sequentially through a database, but can't find the code to put behind a "Next" and "Previous" button. Can anyone help me. Thanks

Comments

  • hi,

    Can u be more specific in your question?

    thanks
  • : hi,
    :
    : Can u be more specific in your question?
    :
    : thanks
    :
    Yes, I am putting only certain information on a screen from each row. I need to show all the records that have a similar word in one of their fields, one at a time. A data grid is not the answer. In non-web based VB you use the command "Me.BindingContext(Awainfo1, "awa for vb").Position += 1". to go to the next item in the dataset, I would like to know how to do the same in a web based program.
    Thanks
    CarlDis
  • ':: Set up Connection ::
    Dim cn As New SqlConnection("...")
    Dim cmd As New SqlCommand("...", cn)
    cn.Open()

    ':: Assign Command to Adapter ::
    Dim adpt As New SqlDataAdapter
    adpt.SelectCommand = cmd

    ':: Fill DataSet ::
    Dim ds As New DataSet
    adpt.Fill(ds, "DataSet")

    ':: Retrieve row in DataSet Table::
    Dim i As Integer
    For i = 0 To ds.Tables(0).Rows.Count - 1

    ':: Retrieve row at the index ::
    Dim drw As DataRow = ds.Tables(0).Rows(i)

    ':: Display something to Label ::
    Label.text = drw(0).ToString
    Next

    cn.Close()

    ----------------------------------------------------
    ds.Tables(0).Rows(i) refers to the row of the 1st table in dataSet at the current index

    drw(0) means the 1st item of that row


    hope this helps ya

    xianxian


  • Although, I could not use it as written for what I wanted, there was enough information to help me out and let me accomplish what I wanted. Thank you very much for your help.
    CarlDis



    : ':: Set up Connection ::
    : Dim cn As New SqlConnection("...")
    : Dim cmd As New SqlCommand("...", cn)
    : cn.Open()
    :
    : ':: Assign Command to Adapter ::
    : Dim adpt As New SqlDataAdapter
    : adpt.SelectCommand = cmd
    :
    : ':: Fill DataSet ::
    : Dim ds As New DataSet
    : adpt.Fill(ds, "DataSet")
    :
    : ':: Retrieve row in DataSet Table::
    : Dim i As Integer
    : For i = 0 To ds.Tables(0).Rows.Count - 1
    :
    : ':: Retrieve row at the index ::
    : Dim drw As DataRow = ds.Tables(0).Rows(i)
    :
    : ':: Display something to Label ::
    : Label.text = drw(0).ToString
    : Next
    :
    : cn.Close()
    :
    : ----------------------------------------------------
    : ds.Tables(0).Rows(i) refers to the row of the 1st table in dataSet at the current index
    :
    : drw(0) means the 1st item of that row
    :
    :
    : hope this helps ya
    :
    : xianxian
    :
    :
    :
  • hi,

    no prob & ur welcome =)

    xianxian
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion