我正在使用ASP.NET Web API,當我運行此方法時出現此錯誤發生了錯誤。ASP.NET Web API發生錯誤
public List<DeviceClass> CheckDevice(string device)
{
devices = new List<DeviceClass>();
using(connection = new SqlConnection(connectionString))
{
using (SqlCommand command = new SqlCommand("uspCheckDeviceID", connection))
{
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add("@sp", SqlDbType.VarChar).Value = device;
connection.Open();
using (SqlDataReader reader = command.ExecuteReader())
{
if(reader.HasRows)
{
if(reader.Read())
{
DeviceClass model = new DeviceClass();
model.DeviceId = reader.GetValue(0).ToString();
model.Name = reader.GetValue(1).ToString();
model.Owner = reader.GetValue(2).ToString();
devices.Add(model);
}
}
connection.Close();
}
}
}
return devices;
}
我試圖確定它的代碼或它的服務器連接。
這是存儲過程我有一個例子:
declare @sp varchar(30)
set @sp ='marksiphoneid'
exec uspCheckDeviceID @sp
是不是有什麼毛病,我想從我的存儲過程的結果呢?
的誤差
無法加載資源:服務器迴應500(內部服務器錯誤)的狀態
你打算告訴我們發生了什麼樣的錯誤,或者我們應該使用我們的集體精神力量嗎?:) – DavidG
不錯的@DavidG – user979331
你還沒有向我們提供服務器的錯誤。 500內部服務器錯誤意味着你需要弄清楚服務器端錯誤是什麼。 – mason