datasets

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Peter Newman

    #1

    datasets

    Im running Vb.net 2003 and SQL2005

    I manage to create a DataSet ( Client_RS ) and bind the data to the
    textboxes,
    I know there are about 450 records ( rows ) returned in the dataset but when
    i
    try to navigate through it row by row the display data for strLicence.text ,
    does not change

    Im trying to produce a data input / amend screen where users can add and
    update records, but all the examples i have found seen to only relate to
    datagrids

    Can Anybody give me any pointers?


    Private Client_RS As New DataSet

    ' Load the DataSet with the client admin recordset
    Private Sub LoadDataSet()
    ' Try to retrieve the records
    Try
    Client_RS = GetSQLDataSet(" EXEC Bossdata.dbo.SQ L2005_ADMINRS")
    Try
    LoadControls(0)
    Catch ex As Exception
    ' Put In error trapping Here
    ' Temporary Message
    MsgBox("Error Seeking 1st Record " & ex.Message)
    ' End Temporary Message
    End Try
    BindControls()
    Catch ex As Exception
    ' Put In error trapping Here
    ' Temporary Message
    MsgBox("Error Generating Recordset " & ex.Message)
    ' End Temporary Message
    End Try
    End Sub

    ' Navigation controls
    Private Sub RS_Navagate(ByV al CURRENT_ROW As Integer, ByVal Directon As
    Integer)
    Const NEXTRECORD As Integer = 0
    Const PREVIOUSRECORD As Integer = 1
    Const FIRSTRECORD As Integer = 2
    Const LASTRECORD As Integer = 3
    Select Case Directon
    Case NEXTRECORD
    If CURRENT_ROW <
    Client_RS.Table s("TBL_ClientAd min").Rows.Coun t - 1 Then
    CURRENT_ROW += 1
    End If
    Case PREVIOUSRECORD
    If CURRENT_ROW 0 Then
    CURRENT_ROW -= 1
    End If
    Case FIRSTRECORD
    CURRENT_ROW = 0
    Case LASTRECORD
    CURRENT_ROW = Client_RS.Table s("TBL_ClientAd min").Rows.Coun t
    - 1
    End Select
    End Sub

    Protected Sub BindControls()
    strLicence.Data Bindings.Add("t ext", Client_RS,
    "TBL_ClientAdmi n.Licence")
    End Sub
  • Kerry Moorman

    #2
    RE: datasets

    Peter,

    I don't see where you are using a currencymanager to navigate through the
    dataset.

    Here is one approach that might work for you:

    In the declarations section of your form, create a currencymanager :

    Dim Manager As CurrencyManager

    In your binding subprocedure, assign the bindingcontext to the
    currencymanager :

    Protected Sub BindControls()
    strLicence.Data Bindings.Add("t ext", Client_RS,
    "TBL_ClientAdmi n.Licence")

    Manager = Me.BindingConte xt(Client_RS, "TBL_ClientAdmi n")
    End Sub

    Now, in your navigation routine, manipulate the Position property of the
    currencymanager :

    Comment

    Working...