السلام عليكم ...
أرجو المساعدة في تصحيح هذا الكود ... الكود خاص بموضوع الـ Autocomplete
الكود:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Web.Script.Services;
using System.Web.Services.Protocols;
using System.Collections.Generic;
using System.Configuration;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
[System.Web.Script.Services.ScriptMethod()]
[System.Web.Services.WebMethod]
public static List<string> GetCountries(string prefixText)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["mega meal"].ToString());
con.Open();
SqlCommand cmd = new SqlCommand("select * from caloies_fact where fact_name like @Name+'%'", con);
cmd.Parameters.AddWithValue("@Name", prefixText);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
List<string> CountryNames = new List<string>();
for (int i = 0; i < dt.Rows.Count; i++)
{
CountryNames.Add(dt.Rows[1].ToString());
}
return CountryNames;
}
}الخطا في هذه الصورة...

ماهو الخطا؟
ماهو الـ service method?
ما هي وظيفتها؟
وأين يتم كتابة الكود الخاص بها؟