OpenSqlConnection();
SqlCommand cmd = new SqlCommand("ReturnCharacterInfo", Con);
cmd.Parameters.AddWithValue("@CharacterID", CharacterID);
SqlDataReader dr = cmd.ExecuteReader();
当我运行您可以在上面看到的代码时,它会引发异常
过程或函数“ReturnCharacterInfo”需要未提供的参数“@CharacterID”。
但正如您在代码中看到的那样,我正在提供@CharacterID
参数并且它不是空的或空的。
存储过程:
[ReturnCharacterInfo] @CharacterID int
as
select
CharacterName, characterSurname, CharacterIsMale, CharacterAge,
CharacterMood, CharacterHealth, CharacterInCity, CharacterInLocation,
Cities.CityName, Locales.LocaleTitle
from
Characters
INNER JOIN
Cities on Cities.CityID = Characters.CharacterInCity
INNER JOIN
Locales on Locales.LocaleID = Characters.CharacterInLocation
Where
CharacterID = @CharacterID
有什么建议么?