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