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 with code

DataSet writing errors with code

Scheduled Pinned Locked Moved Visual Basic
question
5 Posts 3 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. 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 4 TST4 4 Record 4 5

    S 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. 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 4 TST4 4 Record 4 5

      S Offline
      S Offline
      Sathesh Sakthivel
      wrote on last edited by
      #2

      While you Post you got a warniing abt this message is too long? so please post what is your problem on which line you got problem ? Be specific to your question? So that we can answer easily to solve your problem.

      Regards, Satips.:rose:

      Q 1 Reply Last reply
      0
      • S Sathesh Sakthivel

        While you Post you got a warniing abt this message is too long? so please post what is your problem on which line you got problem ? Be specific to your question? So that we can answer easily to solve your problem.

        Regards, Satips.:rose:

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

        Satips: I don't know exactly where the application fails. There are two different methods of entering data that should produce the same results, but don't. Cleako asked for the code on Friday 1 Jun 07 when I first posted it. Today I reposted the question showing exactly what is happening and attached the code at the bottom of the letter so if some one needed the code they could look at it. Do I need to get with Microsoft for a resolution to this problem? Quecumber256

        M 1 Reply Last reply
        0
        • Q Quecumber256

          Satips: I don't know exactly where the application fails. There are two different methods of entering data that should produce the same results, but don't. Cleako asked for the code on Friday 1 Jun 07 when I first posted it. Today I reposted the question showing exactly what is happening and attached the code at the bottom of the letter so if some one needed the code they could look at it. Do I need to get with Microsoft for a resolution to this problem? Quecumber256

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

          I asked for the Binding portion, I apologize for not getting back with you. I honestly dont know why you are having an issue with this because it looks correct, it looked correct before, and unless you changed it Im sure it's still correct. What you are doing is one of the most basic functions of ADO.NET.


          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

            I asked for the Binding portion, I apologize for not getting back with you. I honestly dont know why you are having an issue with this because it looks correct, it looked correct before, and unless you changed it Im sure it's still correct. What you are doing is one of the most basic functions of ADO.NET.


            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
            #5

            Thank you for reassuring me I wasn't a dummy :-). I attached the entire form class just in case there was an issue with the data binding portion or something else. I have one other resource looking it over. If he can't find the problem then I'm being forced to use one of my complementry support intances. Thank you, 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