我有以下代码,我试图在其中调用 mysql 存储过程,因为我不能 a)让存储过程在 EF 中工作,b)我不能让 EF LINQ 查询工作,所以我要回到旧的基础知识. 以下错误作为 VS 要求 ExecuteQuery 提供参数的行。这不是我在打电话之前已经做过的吗?
Public Shared Function GetNearestWeatherStationSql(ByVal lat As Decimal, longi As Decimal) As String
Const connectionString As String = "server=xxxxxx;user=xxxxxx;database=xxxxxxx;port=xxxx;password=xxxxxxxx;"
Dim conn As New MySqlConnection()
conn.ConnectionString = connectionString
Dim command As New MySqlCommand()
command.CommandType = CommandType.StoredProcedure
command.CommandText = "Call GetNearestWeatherStation()"
command.Parameters.AddWithValue("@iLat", lat)
command.Parameters.AddWithValue("@iLong", longi)
command.Parameters.AddWithValue("@iWithinMiles", 15)
command.Parameters.AddWithValue("@iTopN", 2)
command.Connection = conn
conn.Open()
command.ExecuteNonQuery()
conn.Close()
Return "p" 'bogus value until I get SP to work
End Function