XMLWebServiceからデータを取得する関数(vb.net上)があります。
Private Function GetDataSchedule() As DataTable
Dim xTable As Data.DataTable
xTable = xMaster.GetSchedule()
'Bind to DataTable
Dim DT As New System.Data.DataTable
DT.Load(xTable.DefaultView) '--> When I set a breakpoint, the error start from here
Return DT
End Function
そして、関数を呼び出すGetDataSchedule()
関数:
Public Sub ShowDataSchedule()
Dim DSSchedule As New System.Data.DataSet
DSSchedule.Tables.Add(GetDataSchedule)
End Sub
しかし、コードを実行すると、エラーメッセージが表示されます。
Unable to cast object of type 'System.Data.DataView' to type 'System.Data.IDataReader'.
関数を実行するだけGetDataSchedule()
では戻り値が返されますが、関数を個別に呼び出すとエラーが発生します。私は何かが足りないのですか?君の力が必要。ありがとう...