Please help i am using this controller to return values from the storedprocedure but i am getting the error below
Error String type can not be converted to action result
Namespace Controllers
Public Class SendController
Inherits Controller
' GET: Send
<HttpPost>
Public Function GetCustomers(searchTerm As String, Pageindex As Integer) As ActionResult
' Dim query As String = "[GetCustomers_Pager2000]"
Dim cmd As New SqlCommand("GetCustomers_Pager2000")
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.AddWithValue("@SearchTerm", searchTerm)
cmd.Parameters.AddWithValue("@PageIndex", Pageindex)
cmd.Parameters.AddWithValue("@PageSize", "15")
cmd.Parameters.Add("@RecordCount", SqlDbType.Int, 4).Direction = ParameterDirection.Output
Return GetData(cmd, Pageindex).GetXml()
End Function
Private Shared Function GetData(cmd As SqlCommand, pageIndex As Integer) As DataSet
Dim strConnString As String = ConfigurationManager.ConnectionStrings("STOREConnectionString").ConnectionString
Using con As New SqlConnection(strConnString)
Using sda As New SqlDataAdapter()
cmd.Connection = con
sda.SelectCommand = cmd
Using ds As New DataSet()
sda.Fill(ds, "Customers")
Dim dt As New DataTable("Pager")
dt.Columns.Add("PageIndex")
dt.Columns.Add("PageSize")
dt.Columns.Add("RecordCount")
dt.Rows.Add()
dt.Rows(0)("PageIndex") = pageIndex
dt.Rows(0)("PageSize") = "15"
dt.Rows(0)("RecordCount") = cmd.Parameters("@RecordCount").Value
ds.Tables.Add(dt)
Return ds
End Using
End Using
End Using
End Function
End Class
End Namespace
The error comes when i reach here
Return GetData(cmd, Pageindex).GetXml()