When i run this with ? i get this error but when i run it without ? it runs well.
{"Message":"No HTTP resource was found that matches the request URI 'http://127.0.0.1/KABOJJAAPPAPI/api/HandlerVBLoadterm/GetCustomersJSON?customerid='0782911364'&customerid2='Father''."}
Imports System.Data.SqlClient
Imports System.Net
Imports System.Web.Http
Namespace Controllers
Public Class HandlerVBLoadtermController
Inherits ApiController
<Route("api/HandlerVBLoadterm/GetCustomersJSON/{customerid}/{customerid2}")>
<HttpGet>
Public Function GetCustomersJSON(customerId As String, customerId2 As String) As IHttpActionResult
Dim customers As New List(Of Customer)()
Using conn As New SqlConnection()
conn.ConnectionString = ConfigurationManager.ConnectionStrings("KABOJJAConnectionString").ConnectionString
Using cmd As New SqlCommand()
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "Gettermnew"
cmd.Parameters.AddWithValue("@p", customerId)
cmd.Parameters.AddWithValue("@s", customerId2)
cmd.Connection = conn
conn.Open()
Using sdr As SqlDataReader = cmd.ExecuteReader()
While sdr.Read()
customers.Add(New Customer With {
.Account = If(IsDBNull(sdr("Admno")), String.Empty, sdr("Admno")),
.Expressed = If(IsDBNull(sdr("Expressed")), String.Empty, sdr("Expressed"))})
End While
End Using
conn.Close()
End Using
Return Ok(customers)
End Using
End Function
End Class
Public Class Customer
Public Property Account() As String
Public Property Expressed() As String
End Class
End Namespace
this runs well
http://127.0.0.1/KABOJJAAPPAPI/api/HandlerVBLoadterm/GetCustomersJSON/0782911364/Father
and it brings this data
[{"Account":"19-07561","Expressed":"END TERM 1 2019"},{"Account":"19-07561","Expressed":"END TERM 2 2019"},{"Account":"19-07561","Expressed":"END TERM 2 2020"},{"Account":"19-07561","Expressed":"END TERM 3 2019"},{"Account":"19-07561","Expressed":"END TERM 3 2020"},{"Account":"19-07561","Expressed":"MID TERM 1 2019"},{"Account":"19-07561","Expressed":"MID TERM 1 2020"},{"Account":"19-07561","Expressed":"MID TERM2 2019"},{"Account":"19-07561","Expressed":"MID TERM3 2019"},{"Account":"19-07780","Expressed":"END TERM 2 2020"},{"Account":"19-07780","Expressed":"END TERM 3 2020"},{"Account":"19-07780","Expressed":"MID TERM 1 2020"},{"Account":"19-07781","Expressed":"END TERM 3 2020"},{"Account":"99-00004","Expressed":"END TERM 2 2020"},{"Account":"99-00004","Expressed":"END TERM 3 2020"},{"Account":"99-00004","Expressed":"MID TERM 1 2020"}]