Quote Originally Posted by 1369Times View Post
Apology, here's the function that's throwing the exception. The dt is already defined as a parameter.

Code:
Private Function ConvertDataToString(ByVal dt As DataTable) As String
    Dim conversion As String = String.Empty

    Using writer As IO.TextWriter = New IO.StringWriter()
        dt.WriteXml(writer, XmlWriteMode.WriteSchema)
        conversion = writer.ToString()
    End Using

    Return conversion
End Function
You are passing a DataTable into this function, you have even named the parameter dt - simply make sure whatever DataTable you pass into this function has a name and it should work just fine.