none
using .getchanges method to get changed rows in a dataset that contain 2+ tables RRS feed

  • Question

  • so i doing the update using the excutenonquery

    i get the changed  from that dataset whether added of modified then update them

    now imagine i have 2 tables in this dataset 

    when i use get changes it get me the changes but i dont know from which table

    so when i do code like this to make sure if there any change in one of the tables

           Dim modified As DataTable
            Dim added As DataTable
           If objdsOrders.HasChanges(DataRowState.Modified) Then
            modified = objdsOrders.Tables(1).GetChanges(DataRowState.Modified)
            If modified.Rows.Count > 0 Then

          ' update code here

             end if

    when i run this code

    i get error at this line

      modified = objdsOrders.Tables(1).GetChanges(DataRowState.Modified)

    that says

    object reference not set to an instance of an object

    my question is how to make sure that a table in the dataset has changes before i do my code ,cause this method

     If objdsOrders.HasChanges(DataRowState.Modified) Then

    is true whether the change in table 0,1 or both

    so if i did change in table 0 it get updated but when the code reach table 1 it gives error

    i hope my question is clear

    i know that one solution is to put each update or add query alone inside try end try statment

    so one query wont affect others but if there is a way to check it would be much better

    thanks



    I am A Medical Doctor

    Tuesday, August 29, 2017 12:23 AM

All replies

  • Hi Medical Doctor,

    >>object reference not set to an instance of an object

    Form the error, modified table gets a nothing value.

    I made a test on your problem, my code follows.

    Imports System.Data.SqlClient
    
    
    Module Module1
    
    
        Sub Main()
    
            Dim connString As String = "Data Source = your server; Initial Catalog = databaseName;Integrated Security=SSPI;"
    
            Dim modified As DataTable
    
            Dim table As New DataTable()
    
            Dim dataset As New DataSet()
    
            Using connection As New SqlConnection(connString)
    
                connection.Open()
    
                Dim adapter As New SqlDataAdapter()
    
                Dim cmd As New SqlCommand("select * from Contacts select * from TableCs", connection)
    
                adapter.SelectCommand = cmd
    
                adapter.Fill(dataset)
    
            End Using
    
            dataset.Tables(0).Rows(1).SetModified()
    
            dataset.Tables(1).Rows(1).SetModified() ’modified table 1 ,the error didn’t occur
    
            If dataset.HasChanges(DataRowState.Modified) Then
    
                modified = dataset.Tables(1).GetChanges(DataRowState.Modified)
    
                If modified.Rows.Count > 0 Then
    
                    Console.WriteLine("Update code")
    
                End If
    
            End If
    
        End Sub
    
    End Module
    

    It worked well on my side, you could refer to it.

    For the above instance, my dataset has two tables as the above picture. When I didn’t modified table 1, I got your problem, but the error happen in If modified.Rows.Count > 0 Then, as follows.

    Because table 1 is not modified, the modified table is nothing. When I added the following code, the error didn’t occur.

    dataset.Tables(1).Rows(1).SetModified() ’modified table 1 ,the error didn’t occur

    >>using .getchanges method to get changed rows in a dataset that contain 2+ tables

    >>so if i did change in table 0 it get updated but when the code reach table 1 it gives error

    You said your dataset has two or more tables. I think you could debug your code and check whether objdsOrders has two or more tables. If it has two or more tables, your error was caused because your table 1 is not modified and so objdsOrders.Tables(1).GetChanges(DataRowState.Modified) returns a null value . You could add the following code to your code.

         …
    
           objdsOrders.Tables(1).Rows(1).SetModified()' modified your table 1
           If objdsOrders.HasChanges(DataRowState.Modified) Then
            modified = objdsOrders.Tables(1).GetChanges(DataRowState.Modified)
            …
    

    If you still get the error, you could debug your code, and check whether objdsOrders has two or more tables.    

    If you could provide more code to reproduce your problem,  I will help you better and faster.

    Best Regards,

    Cole

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Tuesday, August 29, 2017 8:56 AM
    Moderator
  • Hey Doc,

    As Cole said, the modified table will be null (or Nothing in VB), so you would need to check for that.

    A better alternative is to get changes for the whole DataSet at once,  not table by table. Your code would look like this (notice the use of the .Clone() method, which copies the structure of the existing DataSet, but not the data):

    Dim modified As DataSet = objdsOrders.Clone()
    Dim added As DataSet = objdsOrders.Clone()
    If objdsOrders.HasChanges(DataRowState.Modified) Then
        modified = objdsOrders.GetChanges(DataRowState.Modified)
        
    ... etc. etc.   


    ~~Bonnie DeWitt [C# MVP]

    http://geek-goddess-bonnie.blogspot.com

    Tuesday, August 29, 2017 3:43 PM
  • thanks for your reply

    the thing is 

    yeah i have two tables in this example in the dataset 

    and the customer is not obligated to modify,add or delete from the two tables at the same time

    he can modify here ,add there or even do nothing

    so when he press the update button i check for modified rows to do the update command

    then check again for added rows to do the update command

    and so on

    so the way i know to check for such changes is to check the entire dataset ,i didnt find a way to check which table got the changes so i deal with it

    so for example in this scenario i wrote 2 update commands code and 2 add command code each target both tables and i put them all together in the update button

    this is the code

      Dim command As String
            Dim modified As DataTable
            Dim added As DataTable
            Try
                If objdsOrders.HasChanges(DataRowState.Modified) Then
                    modified = objdsOrders.Tables(1).GetChanges(DataRowState.Modified)
                    If modified.Rows.Count > 0 Then
                        For Each row As DataRow In modified.Rows
                            If IsDBNull(row.Item(3)) Then row.Item(3) = 0
                            If IsDBNull(row.Item(14)) Then row.Item(14) = 0
                            If IsDBNull(row.Item(15)) Then row.Item(15) = 0
                            If IsDBNull(row.Item(16)) Then row.Item(16) = 0
                            If IsDBNull(row.Item(17)) Then row.Item(17) = 0
                            If IsDBNull(row.Item(19)) Then row.Item(19) = 0
                            If IsDBNull(row.Item(20)) Then row.Item(20) = 0
    
                            command = "update ETA set [REL]={0}, [CT]={1}, [CONTENTS]='{2}', [VESSEL]='{3}', [BL]='{4}', " _
                                                         & " [INVOICE]='{5}', [CURRENCY]='{6}', [LC]='{7}',[TYPE]='{8}', [ADVANCE]={9}, [CUSTOMS]={10}, " _
                                                         & "[2NDPAYMENT]={11}, [FULL]={12},  [DAYS]={13}, [DAYSND]={14} "
                            command = String.Format(command, row.Item(1), row.Item(3), row.Item(4), row.Item(5), row.Item(6) _
                                                    , row.Item(9), row.Item(10), row.Item(11), row.Item(13), row.Item(14), row.Item(15), row.Item(16), row.Item(17) _
                                                 , row.Item(19), row.Item(20))
                            If Not IsDBNull(row.Item(2)) Then command += " ,[DATE]='" + CStr(CDate(row.Item(2)).ToShortDateString + "'")
                            If Not IsDBNull(row.Item(7)) Then command += " ,[ETA]='" + CStr(CDate(row.Item(7)).ToShortDateString + "'")
                            If Not IsDBNull(row.Item(8)) Then command += " ,[INVOICEDATE]='" + CStr(CDate(row.Item(8)).ToShortDateString + "'")
                            If Not IsDBNull(row.Item(12)) Then command += " ,[RECD]='" + CStr(CDate(row.Item(12)).ToShortDateString + "'")
                            If Not IsDBNull(row.Item(18)) Then command += " ,[BLDATE]='" + CStr(CDate(row.Item(18)).ToShortDateString + "'")
                            If Not IsDBNull(row.Item(21)) Then command += " ,[DUE]='" + CStr(CDate(row.Item(21)).ToShortDateString)
                            If Not IsDBNull(row.Item(22)) Then command += " ,[DUE2ND]='" + CStr(CDate(row.Item(22)).ToShortDateString + "'")
                            command += " where id=" & CStr(row.Item(0))
                            [GLOBAL].mdlVaribals.UpdateDataSource(command)
                        Next
                    End If
                End If
            Catch ex As Exception
    
            End Try
            Try
                If objdsOrders.HasChanges(DataRowState.Added) Then
                    added = objdsOrders.Tables(1).GetChanges(DataRowState.Added)
                    If added.Rows.Count > 0 Then
                        For Each row As DataRow In added.Rows
                            If IsDBNull(row.Item(3)) Then row.Item(3) = 0
                            If IsDBNull(row.Item(14)) Then row.Item(14) = 0
                            If IsDBNull(row.Item(15)) Then row.Item(15) = 0
                            If IsDBNull(row.Item(16)) Then row.Item(16) = 0
                            If IsDBNull(row.Item(17)) Then row.Item(17) = 0
                            If IsDBNull(row.Item(19)) Then row.Item(19) = 0
                            If IsDBNull(row.Item(20)) Then row.Item(20) = 0
                            Dim cmdDate1 As String = ""
                            Dim cmdDate2 As String = ""
                            Dim command2 As String
                            command = "insert into ETA ([REL], [CT], [CONTENTS], [VESSEL], [BL], [INVOICE], [CURRENCY], [LC],  [TYPE], [ADVANCE], [CUSTOMS], " _
                                                         & "[2NDPAYMENT], [FULL],[DAYS], [DAYSND] "
                            command2 = " values ({0},{1},'{2}','{3}','{4}','{5}','{6}','{7}','{8}',{9},{10},{11},{12},{13},{14}"
                            command2 = String.Format(command2, row.Item(1), row.Item(3), row.Item(4), row.Item(5), row.Item(6) _
                                                    , row.Item(9), row.Item(10), row.Item(11), row.Item(13), row.Item(14), row.Item(15), row.Item(16), row.Item(17) _
                                                 , row.Item(19), row.Item(20))
                            If Not IsDBNull(row.Item(2)) Then cmdDate1 += " ,[DATE]" : cmdDate2 += CStr(",'" & CDate(row.Item(2)).ToShortDateString + "'")
                            If Not IsDBNull(row.Item(7)) Then cmdDate1 += " ,[ETA]" : cmdDate2 += CStr(",'" & CDate(row.Item(7)).ToShortDateString + "'")
                            If Not IsDBNull(row.Item(8)) Then cmdDate1 += " ,[INVOICEDATE]" : cmdDate2 += CStr(",'" & CDate(row.Item(8)).ToShortDateString + "'")
                            If Not IsDBNull(row.Item(12)) Then cmdDate1 += " ,[RECD]" : cmdDate2 += CStr(",'" & CDate(row.Item(12)).ToShortDateString + "'")
                            If Not IsDBNull(row.Item(18)) Then cmdDate1 += " ,[BLDATE]" : cmdDate2 += CStr(",'" & CDate(row.Item(18)).ToShortDateString + "'")
                            If Not IsDBNull(row.Item(21)) Then cmdDate1 += " ,[DUE]" : cmdDate2 += CStr(",'" & CDate(row.Item(21)).ToShortDateString + "'")
                            If Not IsDBNull(row.Item(22)) Then cmdDate1 += " ,[DUE2ND]" : cmdDate2 = CStr(",'" & CDate(row.Item(22)).ToShortDateString + "'")
                            cmdDate1 += ")"
                            cmdDate2 += ")"
                            command += cmdDate1
                            command += command2
                            command += cmdDate2
                            MsgBox(command)
                            [GLOBAL].mdlVaribals.UpdateDataSource(command)
                        Next
                    End If
                End If
            Catch ex As Exception
    
            End Try
    
            Dim modifiedOrders As DataTable
            Dim addedOrders As DataTable
            Try
                If objdsOrders.HasChanges(DataRowState.Modified) Then
                    modifiedOrders = objdsOrders.Tables(0).GetChanges(DataRowState.Modified)
                    If modifiedOrders.Rows.Count > 0 Then
                        For Each row As DataRow In modifiedOrders.Rows
                            If IsDBNull(row.Item(4)) Then row.Item(4) = 0
                            If IsDBNull(row.Item(5)) Then row.Item(5) = 0
                            If IsDBNull(row.Item(6)) Then row.Item(6) = 0
                            If IsDBNull(row.Item(7)) Then row.Item(7) = 0
                            If IsDBNull(row.Item(8)) Then row.Item(8) = 0
                            If IsDBNull(row.Item(9)) Then row.Item(9) = 0
                            Dim commandOrders As String = "update orders set   [PI]='{0}', [CONTENTS]='{1}', [CT]={2}, [QTN CONT]={3}, [TOTAL QTY]={4}, " _
                                                     & " [UNIT PRICE]={5}, [CONT COST]={6}, [TOTAL COST]={7} "
                            commandOrders = String.Format(commandOrders, CStr(row.Item(2)), CStr(row.Item(3)), CStr(row.Item(4)), CStr(row.Item(5)) _
                                                          , CStr(row.Item(6)), CStr(row.Item(7)), CStr(row.Item(8)), CStr(row.Item(9)))
                            If Not IsDBNull(row.Item(1)) Then commandOrders += " ,[DATE]='" + CStr(CDate(row.Item(1)).ToShortDateString + "'")
                            commandOrders += " where [id]=" & CStr(row.Item(0))
                            MsgBox(commandOrders)
                            [GLOBAL].mdlVaribals.UpdateDataSource(commandOrders)
                        Next
                    End If
                End If
            Catch ex As Exception
    
            End Try
            Try
                If objdsOrders.HasChanges(DataRowState.Added) Then
                    addedOrders = objdsOrders.Tables(0).GetChanges(DataRowState.Added)
    
                    If addedOrders.Rows.Count > 0 Then
                        For Each row As DataRow In addedOrders.Rows
                            If IsDBNull(row.Item(4)) Then row.Item(4) = 0
                            If IsDBNull(row.Item(5)) Then row.Item(5) = 0
                            If IsDBNull(row.Item(6)) Then row.Item(6) = 0
                            If IsDBNull(row.Item(7)) Then row.Item(7) = 0
                            If IsDBNull(row.Item(8)) Then row.Item(8) = 0
                            If IsDBNull(row.Item(9)) Then row.Item(9) = 0
                            Dim cmdDateOrders1 As String = ""
                            Dim cmdDateOrders2 As String = ""
                            Dim commandOrders As String = "insert into orders ([PI], [CONTENTS], [CT], [QTN CONT], [TOTAL QTY], " _
                                                     & " [UNIT PRICE], [CONT COST], [TOTAL COST]" & cmdDateOrders1 & ") values ('{0}','{1}',{2},{3},{4},{5},{6},{7}" & cmdDateOrders2 & ")"
                            commandOrders = String.Format(commandOrders, CStr(row.Item(2)), CStr(row.Item(3)), CStr(row.Item(4)), CStr(row.Item(5)) _
                                                          , CStr(row.Item(6)), CStr(row.Item(7)), CStr(row.Item(8)), CStr(row.Item(9)))
                            If Not IsDBNull(row.Item(2)) Then cmdDateOrders1 += " ,[DATE]" : cmdDateOrders2 += CStr(",'" & CDate(row.Item(2)).ToShortDateString + "'")           '            
                            commandOrders += " where [id]=" & CStr(row.Item(0))
                            MsgBox(commandOrders)
                            [GLOBAL].mdlVaribals.UpdateDataSource(commandOrders)
                        Next
                    End If
                End If
            Catch ex As Exception
    
            End Try

    i engulfed each command under try end try so i dont interrupt other processes

    cole if i did the code u mentioned

     objdsOrders.Tables(1).Rows(1).SetModified()

     

    will this mean that this table will be considered modified?

    i will be updating something the didnt need to be updated or what exactly

    thanks again for ur reply


    I am A Medical Doctor

    Wednesday, August 30, 2017 4:14 AM
  • Hi again, Doc!

    Not being really familiar with Access, let me ask you: does Access support Stored Procedures (like SQL Server) or something similar? If so, I'd use a Stored Procedure rather than code all that stuff in your program. If Access doesn't have Stored Procs, then I guess you're out of luck as far as that goes.

    I see that you're setting a lot of rows that are DBNull.Value to zero. You might be better off making them default to zero somewhere (in your DataSet, or in the grid). That'll save you a lot of work too.

    In my SQL Server Stored Procs, I have all my parameters  default to NULL, so that I don't have to pass that particular parameter if the user hasn't entered any data for it. My Stored Proc then only updates a column if the parameter is not NULL. NULLs are funny though, because people like to assign different meaning to a NULL value in a database. Depends on the functionality you want to use it for ...


    ~~Bonnie DeWitt [C# MVP]

    http://geek-goddess-bonnie.blogspot.com

    Wednesday, August 30, 2017 5:08 AM
  • very nice idea about replacing null in datagridview,brilliant brilliant

    i used this code

      Private Sub grdProducts_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs) Handles grdProducts.CellEndEdit
            For i As Integer = 8 To 12
                If IsDBNull(grdProducts.Item(i, grdProducts.CurrentRow.Index).Value) Then
                    grdProducts.Item(i, grdProducts.CurrentRow.Index).Value = 0
                End If
            Next
        End Sub

    i will look into stored procedures it might be helpful

    abt the null

    ur idea is great abt replacing the numbers,what abt the dates

    u saw i wrote specific addition to my command string cause dates cant have defult value like numbers

    is my way good or there is better solution to it

    thanks again


    I am A Medical Doctor

    Thursday, August 31, 2017 2:26 AM
  • also how to replace it in the dataset instead of the datagridview ,i couldnt find a way to do it

    this is what i found

       objdsProductRelation.Tables(1).Columns(i).DefaultValue = 0

    but it replace all the table and makes the update command tough

    unlike in datagridview is only updating the edited row


    I am A Medical Doctor


    Thursday, August 31, 2017 2:29 AM
  • Hi Doctor,

    >>objdsProductRelation.Tables(1).Columns(i).DefaultValue = 0

    >> lso how to replace it in the dataset instead of the datagridview ,i couldnt find a way to do it

    this is what i found and unlike in datagridview is only updating the edited row

    From your description and your code, the code didn’t implement your feature which I do not understand. You just set a specific column some default values in your dataset.

    Could you please indicate that you would like to implement a feature about your DataSet?

    If you could provide some code which can reproduce your problem, I will help you better and faster

    Best Regards,

    Cole


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, August 31, 2017 10:25 AM
    Moderator
  • you said

     You might be better off making them default to zero somewhere (in your DataSet, or in the grid). That'll save you a lot of work too.

    the code i find to replace the null value is this code

    objdsProductRelation.Tables(1).Columns(i).DefaultValue = 0

    this code replace the null values in all the rows and i dont want that cause when i update i have to update all those rows  although it wasnt really changed by the user 

    i only want him to replace the null values in those columns only in the row that the user is currently editingi hope you got my idea

    like in the datagridview code above it only change in the null values in the row the user is editing not all the null values in all rows


    I am A Medical Doctor

    Friday, September 1, 2017 1:32 AM
  • i asked you this before 

     if i did the code u mentioned

     objdsOrders.Tables(1).Rows(1).SetModified()

     

    will this mean that this table will be considered modified?

    i will be updating something the didnt need to be updated or what exactly


    I am A Medical Doctor

    Friday, September 1, 2017 1:33 AM
  • Hi Doctor,

    >> objdsOrders.Tables(1).Rows(1).SetModified()

    I think your previous problem has been resolved, so I did not  explain it. I just set the row state modified to make a test. If  you would like to know more about it, you could refer to the following link.

    https://msdn.microsoft.com/en-us/library/system.data.datarow.setmodified(v=vs.110).aspx

    From your description, I suppose that you would like to set the null values of every row to 0 in your dataset. I think that you could set the default based on the index of rows and the name of columns in your dataset, as follows. Please take a reference.

     Dim columns = dataset.Tables(1).Columns
    
            Dim index As Integer = 0 'save an index which you edit the row 
    
            'select a row which you are eidting 
    
            Dim rows = dataset.Tables(1).AsEnumerable().Where(Function(s) Convert.ToInt32(s("primaryID")) = 1)
    
            If rows IsNot Nothing Then
    
                For Each row As DataRow In rows
    
                    ' get the index of a row which you are editing .
    
                    index = dataset.Tables(1).Rows.IndexOf(row)
    
                    ' set the columns‘ null values of the row which you select to 0 and default set first row
    
                    For j As Integer = 0 To columns.Count - 1
    
                        Dim data = dataset.Tables(1).Rows(index)(columns(j).ColumnName).ToString()
    
                       
    If String.IsNullOrEmpty(data) Then
    
                            dataset.Tables(1).Rows(index)(columns(j).ColumnName) = 0
    
                        End If
    
                    Next
    
                Next
    
            End If
    

    Here is result



    After setting:

    First name is changed from null to 0 and second name is not changed.

    If you have any other question about my reply, please contact me freely.

    Best Regards,

    Cole


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, September 1, 2017 9:16 AM
    Moderator
  • I still think you should use Stored Procedures, as I mentioned previously. Access *does* support them (I just Googled it).

    I previously wrote:

    In my SQL Server Stored Procs, I have all my parameters  default to NULL, so that I don't have to pass that particular parameter if the user hasn't entered any data for it. My Stored Proc then only updates a column if the parameter is not NULL. NULLs are funny though, because people like to assign different meaning to a NULL value in a database. Depends on the functionality you want to use it for ...

    This way, you don't set a parameter if it's DBNull.Value, and the Stored Proc will then not do an update of that column. In SQL Server, the command is this:

    UPDATE MyTable
    SET Mykey = ISNULL(@Mykey, Mykey),
        MyColumn = ISNULL(@MyColumn, MyColumn),
        MyOtherColumn = ISNULL(@MyOtherColumn, MyOtherColumn)
    WHERE Mykey = @Mykey

    Sorry, I don't know what the corresponding syntax would be in Access.

    Then change the previous code I posted (the one to set the parameters for a Row), to this (again, sorry about the C#):

    for (int i = 0; i < Row.Table.Columns.Count; i++)
    {
        if (Row[i] != DBNull.Value)
            command.Parameters.AddWithValue(Row.Table.Columns[i].ColumnName, Row[i]);
    }


    ~~Bonnie DeWitt [C# MVP]

    http://geek-goddess-bonnie.blogspot.com

    Friday, September 1, 2017 4:03 PM
  • as i told you 

    i engulf each command inside try end try so it doesnt affect other commands

    but if i set the table to be modified then i the code for updating this table will occur thouh it wasnt changd by the user

    my question is there a way to check if this table in particular get changes or the idea i presented which is to engulf them in try end try is good solution

    thanks


    I am A Medical Doctor

    Friday, September 1, 2017 6:27 PM
  • Hi Doc,

    I don't know why you are using .SetModified() ... you shouldn't be. If the user makes a change in the DataGridView, then the row in the DataTable will be considered to be modified. And that's all you should need.

    However, under certain conditions, the Proposed changes to a DataRow may not have been Current and GetChanges() will not be aware that there are any changes (or if there have been some changes, it won't retrieve any data that is still in the Proposed state). There are things you can do before saving your data back to the database, to make sure all user changes are accounted for.

    How you handle that depends on what DataBinding you're using with your grid. If you're using a BindingSource, then the only you should have the statement MyBindingSource.EndEdit() before checking for objdsOrders.HasChanges().  If you're not using a BindingSource, then take a look at my blog post:

    http://geek-goddess-bonnie.blogspot.com/2009/09/fun-with-datasets.html

    I kind of got off an a tangent with that Modified stuff, but you sounded confused about it, so I hope that's been clarified a bit.

    Now, on the another topic ... I don't know why you said "i engulf each command inside try end try so it doesnt affect other commands"  A try/catch doesn't do anything other than catch exceptions. How would that isolate the code from any other database commands? You don't appear to be doing anything when you get an exception, so execution will continue on to the next try/catch block and that *could* affect other commands.

    I also don't understand your reluctance to use a using block for your connection ... you really should! And put the try/catch outside of that. Expanding on a snippet of code that @Cole posted earlier:

    Try
        Using connection As New SqlConnection(connString)
            connection.Open()
            ' do whatever database stuff you have to do
            ' don't bother with try/catch here, the outside try will catch
        End Using
    Catch ex As Exception 
        ' do something with that exception, log it or something
    End Try
    


    ~~Bonnie DeWitt [C# MVP]

    http://geek-goddess-bonnie.blogspot.com

    Friday, September 1, 2017 8:24 PM