2010-11-29 290 views
0

嗨,這裏是我得到的錯誤:得到錯誤,試圖創建一個CRUD Web服務

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(...) 

這是代碼,從Web服務的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不起作用。任何幫助,將不勝感激。

回答

1

顯然music.deleteSongmusic.insertSong返回integer。您應該將返回類型deleteSonginsertSong更改爲與其匹配的整數。

+0

你說得對。謝謝。 – OneSneakyMofo 2010-11-30 01:39:02

相關問題