Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. DataSet writing errors

DataSet writing errors

Scheduled Pinned Locked Moved Visual Basic
question
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    Quecumber256
    wrote on last edited by
    #1

    Can someone tell me the difference between these similar dataset writing routines? The data writing subroutine: Private Sub New_Bindings(ByVal intOrdinal As Integer, _ ByVal strCode As String, _ ByVal strName As String) drCurrent = MyDataSet.Tables("tblBindings").NewRow() drCurrent!Ordinal = intOrdinal drCurrent!BindingCode = strCode drCurrent!BindingName = strName MyDataSet.Tables("tblBindings").Rows.Add(drCurrent) Call Show_Changes("Sub New_Bindings", MyDataSet) End Sub After each row is written into the dataset I have another subroutine that prints out the results called Show_Changes. Case one – The data is placed directly into the subroutine call. I’m writing 5 rows to the dataset like this: Call New_Bindings(1, "TST1", "Record 1") Call New_Bindings(2, "TST2", "Record 2") Call New_Bindings(3, "TST3", "Record 3") Call New_Bindings(4, "TST4", "Record 4") Call New_Bindings(5, "TST5", "Record 5") Output screen results after each row addition: Sub - Sub New_Bindings TableName: tblBindings 1 TST1 1 Record 1 Sub - Sub New_Bindings TableName: tblBindings 1 TST1 1 Record 1 2 TST2 2 Record 2 Sub - Sub New_Bindings TableName: tblBindings 1 TST1 1 Record 1 2 TST2 2 Record 2 3 TST3 3 Record 3 Sub - Sub New_Bindings TableName: tblBindings 1 TST1 1 Record 1 2 TST2 2 Record 2 3 TST3 3 Record 3 4 TST4 4 Record 4 Sub - Sub New_Bindings TableName: tblBindings 1 TST1 1 Record 1 2 TST2 2 Record 2 3 TST3 3 Record 3 4 TST4 4 Record 4 5 TST5 5 Record 5 This works just fine. All the records have been written to the dataset and I can use the BindingNavigator control to go from record to record. Case 2 – The data is placed into the subroutine via variables. Call New_Bindings(CInt(txtOrdinal.Text), txtBindingCode.Text, txtBindingName.Text) Output screen after the same five rows are added using the data entry form. Sub - Sub New_Bindings TableName: tblBindings 1 TST1 1 Record 1 Sub - Sub New_Bindings TableName: tblBindings 1 TST2 2 2 TST2 2 Record 2 Sub - Sub New_Bindings TableName: tblBindings 1 TST3 3 2 TST2 2 Record 2 3 TST3 3 Record 3 Sub - Sub New_Bindings TableName: tblBindings 1 TST4 4 2 TST2 2 Record 2 3 TST3 3 Record 3 4 TST4 4 Record 4 Sub - Sub New_Bindings TableName: tblBindings 1 TST5 5 2 TST2 2 Record 2 3 TST3 3 Record 3

    M 1 Reply Last reply
    0
    • Q Quecumber256

      Can someone tell me the difference between these similar dataset writing routines? The data writing subroutine: Private Sub New_Bindings(ByVal intOrdinal As Integer, _ ByVal strCode As String, _ ByVal strName As String) drCurrent = MyDataSet.Tables("tblBindings").NewRow() drCurrent!Ordinal = intOrdinal drCurrent!BindingCode = strCode drCurrent!BindingName = strName MyDataSet.Tables("tblBindings").Rows.Add(drCurrent) Call Show_Changes("Sub New_Bindings", MyDataSet) End Sub After each row is written into the dataset I have another subroutine that prints out the results called Show_Changes. Case one – The data is placed directly into the subroutine call. I’m writing 5 rows to the dataset like this: Call New_Bindings(1, "TST1", "Record 1") Call New_Bindings(2, "TST2", "Record 2") Call New_Bindings(3, "TST3", "Record 3") Call New_Bindings(4, "TST4", "Record 4") Call New_Bindings(5, "TST5", "Record 5") Output screen results after each row addition: Sub - Sub New_Bindings TableName: tblBindings 1 TST1 1 Record 1 Sub - Sub New_Bindings TableName: tblBindings 1 TST1 1 Record 1 2 TST2 2 Record 2 Sub - Sub New_Bindings TableName: tblBindings 1 TST1 1 Record 1 2 TST2 2 Record 2 3 TST3 3 Record 3 Sub - Sub New_Bindings TableName: tblBindings 1 TST1 1 Record 1 2 TST2 2 Record 2 3 TST3 3 Record 3 4 TST4 4 Record 4 Sub - Sub New_Bindings TableName: tblBindings 1 TST1 1 Record 1 2 TST2 2 Record 2 3 TST3 3 Record 3 4 TST4 4 Record 4 5 TST5 5 Record 5 This works just fine. All the records have been written to the dataset and I can use the BindingNavigator control to go from record to record. Case 2 – The data is placed into the subroutine via variables. Call New_Bindings(CInt(txtOrdinal.Text), txtBindingCode.Text, txtBindingName.Text) Output screen after the same five rows are added using the data entry form. Sub - Sub New_Bindings TableName: tblBindings 1 TST1 1 Record 1 Sub - Sub New_Bindings TableName: tblBindings 1 TST2 2 2 TST2 2 Record 2 Sub - Sub New_Bindings TableName: tblBindings 1 TST3 3 2 TST2 2 Record 2 3 TST3 3 Record 3 Sub - Sub New_Bindings TableName: tblBindings 1 TST4 4 2 TST2 2 Record 2 3 TST3 3 Record 3 4 TST4 4 Record 4 Sub - Sub New_Bindings TableName: tblBindings 1 TST5 5 2 TST2 2 Record 2 3 TST3 3 Record 3

      M Offline
      M Offline
      Marcus J Smith
      wrote on last edited by
      #2

      Will you post your current iteration of the New_Bindings method?


      CleaKO

      "Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)

      Q 1 Reply Last reply
      0
      • M Marcus J Smith

        Will you post your current iteration of the New_Bindings method?


        CleaKO

        "Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)

        Q Offline
        Q Offline
        Quecumber256
        wrote on last edited by
        #3

        Cleako: I'm not sure if I understand you. The current method is the New_Binding subroutine I had at the beginning of the post. Do you want the whole form class? Code and all? Thanks, Quecumber256

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups