【问题标题】:Getting errors with trying to create a CRUD Web Service尝试创建 CRUD Web 服务时出错
【发布时间】:2010-11-29 22:19:31
【问题描述】:

大家好,以下是我遇到的错误:

Value of type 'Integer' cannot be converted to 'music.MusicDataTable'. 
//happens at return deleteSong(...)
Value of type 'Integer' cannot be converted to 'music.MusicDataTable'.
//happens at return insertSong(...)

这是来自网络服务的 vb 页面的代码,我收到错误:

Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols

<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class getMusicList
     Inherits System.Web.Services.WebService

    <WebMethod()> _
    Public Function GetMusic() As music.MusicDataTable
        Dim music As New musicTableAdapters.MusicTableAdapter
        Return music.GetMusic
    End Function

    Public Function deleteSong(ByVal song_title As String) As music.MusicDataTable
        Dim music As New musicTableAdapters.MusicTableAdapter
        Return music.deleteSong(song_title)
    End Function

    Public Function insertSong(ByVal song_album As String, ByVal song_artist As String, ByVal song_file As String, ByVal song_format As String, ByVal song_size As String, ByVal song_time As String, ByVal song_title As String, ByVal song_track As Integer, ByVal song_year As Integer) As music.MusicDataTable
        Dim music As New musicTableAdapters.MusicTableAdapter
        Return music.insertSong(song_album, song_artist, song_file, song_format, song_size, song_time, song_title, song_track, song_year)
    End Function


End Class

MusicDataTable 来自名为音乐的数据集。

GetMusic() 有效,因为我没有传递任何东西。我不确定为什么 insertSong 和 deleteSong 不起作用。任何帮助将不胜感激。

【问题讨论】:

    标签: asp.net vb.net visual-studio-2008


    【解决方案1】:

    显然music.deleteSongmusic.insertSong 返回integer。您应该将deleteSonginsertSong 的返回类型更改为整数以匹配它们。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-11-29
      • 2020-09-02
      • 1970-01-01
      • 2013-12-13
      • 1970-01-01
      • 2014-08-26
      • 2018-06-25
      • 1970-01-01
      相关资源
      最近更新 更多