DataSet writing errors
-
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
-
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
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)
-
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)
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