У меня есть веб-сервис, который выполняет поиск в базе данных для сохраненных шаблонов. Тем не менее, я получаю сообщение об ошибке при запуске приложенияДолжен объявить скалярную переменную «@Template»
Должен объявить скалярную переменную «@Template».
[WebMethod]
public Verification StuVerification (byte[] Template)
{
cn.Open();
SqlCommand com = new SqlCommand("SELECT * FROM tblFingerprint WHERE Template = @Template)", cn);
SqlDataReader sr = com.ExecuteReader();
while (sr.Read())
{
Verification verification = new Verification()
{
StudentID = sr.GetInt32(0),
StudentNumber = sr.GetString(1),
Name = sr.GetString(2),
Surname = sr.GetString(3),
};
cn.Close();
return verification;
}
cn.Close();
return new Verification();
}
Verification ver = verification.StuVerification(m_VrfMin);
Verification v = new Verification();
if (ver.StudentID > 0)
{
// Verification v = new Verification();
richTextBox1.Text = v.StudentNumber;
}
else
{
richTextBox1.Text = "Verification Failed" + error;
}
Где объявлена переменная? –
Я не вижу значения параметров, которые вы добавили в свой параметр 'SqlCommand' для параметра' @ Template'. –
Каков тип данных в поле «Шаблон» в таблице «tblFingerprint» – Steve