Dim myConnection As New OdbcConnection(connectionString)
Dim myCommand As New OdbcDataAdapter( _
"SELECT * FROM Contacts", myConnection)
Dim myDataSet As New DataSet
myCommand.Fill(myDataSet, "Contacts")
GetContacts = myDataSet
Catch ex As Exception
GetContacts = GetErrorDataSet("Exception : " & ex.Message)
End Try
End Function
Ainsi que :
Private Function GetErrorDataSet(ByVal pErrMessage As String) As DataSet
Dans la page ASP.NET qui consomme ce WebService, comment faire pour
savoir si la table 'Error' est bien présente dans le DataSet et ainsi,
ne pas afficher de DataGrid mais plutot un message d'erreur (celui
contenu dans la table 'Error').