Hola,
Tengo este procedimiento almacenado:
***************************************************************************************************
ALTER PROCEDURE [dbo].[PA_DevolverLocalizaciones]
@lon float,
@lat float
AS
declare @Localizacion as char
declare @SearchSize as decimal(18,15)
select @SearchSize = (0.0001)
select @Localizacion = (select top 1 POBLACION from LOCALIZACIONES
where LONGITUD = @lon and LATITUD = @lat)
while @Localizacion is null
begin
select @Localizacion = (select top 1 POBLACION from LOCALIZACIONES
where LONGITUD between @lon-@SearchSize and @lon+@searchSize and
LATITUD between @lat-@SearchSize and @lat+@SearchSize)
select @SearchSize = @SearchSize + 0.001
end
return @Localizacion
***********************************************************************************************
Y en el codigo tengo esto:
Dim oCommand As SqlClient.SqlCommand = New
SqlClient.SqlCommand("[PA_DevolverLocalizaciones]", Conexion)
oCommand.CommandTimeout = 0
oCommand.CommandType = CommandType.StoredProcedure
oCommand.Parameters.Add("@Localizacion",
SqlDbType.Int).Direction() = ParameterDirection.ReturnValue
oCommand.Parameters.Add("@lon", SqlDbType.Float).Value Longitud
oCommand.Parameters.Add("@lat", SqlDbType.Float).Value Latitud
Conexion.Open()
Dim ValorDevuelto As Object = oCommand.ExecuteScalar()
Conexion.Close()
-
Cuando ejecuta "oCommand.ExecuteScalar() me devuelve el error: "Syntax
error converting the varchar value 'MADRID ' to a column of data type
int"
He consultado ya varios foros y este mismo grupo, probando lo q en
estos se comentaba, pero sigo igual.
Gracias, un saludo.
Leer las respuestas