I have writing asp.net webservice which would be accessed by android application. It actually takes string as parameter and then call store procedure to fetch several coordinates (lat, lon). Now i should store it in what and should return what so that android consumer can access rows of data from result being returned ?
public void FetchCoordinates(String FetchParam)
{
String[] parts = FetchParam.Split(',');
sqlCom.CommandText = "FetchCoordinates";
sqlCom.CommandType = CommandType.StoredProcedure;
sqlCom.Parameters.Add("@IMEI", SqlDbType.VarChar).Value = parts[0].ToString();
sqlCom.Parameters.Add("@DateTimeFrom", SqlDbType.VarChar).Value = Convert.ToDateTime(parts[1].ToString());
sqlCom.Parameters.Add("@DateTimeTo", SqlDbType.VarChar).Value = Convert.ToDateTime(parts[2].ToString());
SqlParameter sqlParam = new SqlParameter("@result", SqlDbType.Int);
sqlCom.Parameters.Add(sqlParam);
sqlCom.Parameters["@result"].Direction = ParameterDirection.Output;
try
{
sqlCon.Open();
sqlCom.ExecuteNonQuery();
}
catch (Exception ex)
{
}
finally
{
sqlCon.Close();
}
}
}
SP:
SELECT Longitude ,Latitude
FROM Coordinates
WHERE IMEI = @IMEI
AND RecordedDateTime BETWEEN @DateTimeFrom AND @DateTimeTo
so how should i return LATITUDE, LONGITUDE collection from web service ?